FreeRADIUS 3.0.11 忽略來自一個 NIC 介面的存取請求

FreeRADIUS 3.0.11 忽略來自一個 NIC 介面的存取請求

我已將 FreeRADIUS 3.0.11 安裝到 Ubuntu Server 16.04。 Ubuntu Server 在 ESXi 虛擬機器上運作。虛擬機器有兩個網路卡。一個用於連接到管理網絡,另一個用於連接客戶 LAN。我還使用 PfSense 虛擬機器作為 LAN 和 Ubuntu 伺服器之間的防火牆。

我的網路圖片

問題是當我測試時管理網路 radtest test 1234 192.168.1.144 1812 testing123FreeRADIUS 伺服器會正確通知並回答,但是當我進行測試時區域網路,FreeRADIUS 伺服器根本沒有收到存取請求。我正在調試模式下使用伺服器freeradius -X

IP 是:

Ubuntu server admin NIC, ens160: 192.168.1.144
Ubuntu server NIC to PfSense, ens192: 192.168.34.2
PfSense NIC to Ubuntu server: 192.168.34.1
PfSense LAN NIC: 192.168.33.1

我已經檢查過tcp轉儲Ubuntu 伺服器正在接收存取請求套件。 IP 192.168.33.50 是筆記型電腦的IP。

sudo tcpdump -i ens192 port 1812
10:24:18.578802 IP 192.168.33.50.63334 > 192.168.34.2.radius: RADIUS, Access-Request (1), id: 0x09 length: 44
10:24:19.578202 IP 192.168.33.50.63334 > 192.168.34.2.radius: RADIUS, Access-Request (1), id: 0x09 length: 44

我在用著iptables用於將 HTTP 和 HTTPS 轉送到 PfSense 虛擬機,因此我可以從管理網路對其進行配置。

# Generated by iptables-save v1.6.0 on Wed May  4 10:23:08 2016
*nat
:PREROUTING ACCEPT [2:396]
:INPUT ACCEPT [2:396]
:OUTPUT ACCEPT [3:213]
:POSTROUTING ACCEPT [3:213]
-A PREROUTING -i ens160 -p tcp -m tcp --dport 4954 -j DNAT --to-destination 192.168.34.1:80
-A PREROUTING -i ens160 -p tcp -m tcp --dport 4955 -j DNAT --to-destination 192.168.34.1:443
-A POSTROUTING -d 192.168.34.1/32 -p tcp -m tcp --dport 80 -j SNAT --to-source 192.168.34.2
-A POSTROUTING -d 192.168.34.1/32 -p tcp -m tcp --dport 443 -j SNAT --to-source 192.168.34.2
COMMIT
# Completed on Wed May  4 10:23:08 2016
# Generated by iptables-save v1.6.0 on Wed May  4 10:23:08 2016
*filter
:INPUT ACCEPT [24:2294]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [16:3245]
-A INPUT -p udp -m udp -m multiport --dports 1812 -m comment --comment     "Accept RADIUS" -j ACCEPT
COMMIT
# Completed on Wed May  4 10:23:08 2016

我檢查過 FreeRADIUS 正在偵聽連接埠 1812。

netstat -lun | grep 1812
udp        0      0 127.0.0.1:18120         0.0.0.0:*
udp        0      0 0.0.0.0:1812            0.0.0.0:*
udp6       0      0 :::1812                 :::*

我嘗試將連接埠 1812 從介面轉發到另一個接口,但要么我配置錯誤,要么沒有幫助。我很確定有一些簡單的技巧可以讓它發揮作用,但我還沒有找到。感謝您的幫忙!

更新

我試著把請求記錄透過取消requests = ${logdir}/radiusd-%{%{Virtual-Server}:-DEFAULT}-%Y%m%d.logfile 中的行註解來開啟/etc/freeradius/radiusd.conf。然而,這會引發錯誤,而 freeradius 根本不會啟動。調試模式啟動,但不會寫入 radius.log 檔案到任何內容。

sudo freeradius
radiusd: Error: Failed to parse log{} section.

從版本 3.0.9 開始,請求日誌記錄似乎不再運作。來源:github.com/FreeRADIUS/freeradius-server/issues/1131

答案1

我解決了這個問題。我還必須添加一個到另一個網卡的網關。

這是我的初始/etc/network/interfaces文件:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
# This is an autoconfigured IPv6 interface
#auto ens160
#iface ens160 inet6 auto

# ESXi NIC admin network
auto ens160
iface ens160 inet static
address 192.168.1.144
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.3 192.168.1.2

# ESXi NIC DMZ
auto ens192
iface ens192 inet static
address 192.168.34.2
netmask 255.255.255.0

我新增了第二個路由表(新增了最後一行):

sudo vim /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0   unspec
#
# local
#
#1  inr.ruhep
1 rt2

設定新的路由表:

sudo ip route add 192.168.34.0/24 dev ens192 src 192.168.34.2 table rt2
sudo ip route add default via 192.168.34.1 dev ens192 table rt2

新增路由規​​則:

sudo ip rule add from 192.168.34.2/32 table rt2
sudo ip rule add to 192.168.34.2/32 table rt2

測試配置是否有效並透過修改/etc/network/interfaces檔案使其永久化:

iface ens192 inet static
    address 192.168.34.2
    netmask 255.255.255.0
    post-up ip route add 192.168.34.0/24 dev ens192 src 192.168.34.2 table rt2
    post-up ip route add default via 192.168.34.1 dev ens192 table rt2
    post-up ip rule add from 192.168.34.2/32 table rt2
    post-up ip rule add to 192.168.34.2/32 table rt2

解決方案的來源:https://www.thomas-krenn.com/en/wiki/Two_Default_Gateways_on_One_System

IP表

為了保持我的連接埠轉送運行,我必須添加輸出介面iptables 規則(新增 -o ens192):

-A POSTROUTING -d 192.168.34.1/32 -o ens192 -p tcp -m tcp --dport 80 -j SNAT --to-source 192.168.34.2
-A POSTROUTING -d 192.168.34.1/32 -o ens192 -p tcp -m tcp --dport 443 -j SNAT --to-source 192.168.34.2

相關內容