FreeBSD 6.1 + ath0 + NAT

Phil Chadwick p.chadwick at internode.on.net
Wed Sep 13 06:06:54 PDT 2006


Hi all,

This is my first post, so please be gentle :-)

I have a Linksys WAG54G V.2 ADSL modem (Firmware Version: 1.00.39)
connection to the Internet, and a Netgear WG311T wireless Ethernet card
running on FreeBSD 6.1 (PC#1).

Recently I added a second FreeBSD 6.1 system (PC#2) which has no
wireless card (well it does, but it's a TI chipset not supported in
FreeBSD).  So I connected it to PC#1 with a Gigabit copper wire
connection.  I also added firewall and NATing on PC#1 to provide PC#2
with a route to the Internet.

When I boot PC#1, the connection between ath0 and the ADSL modem will run
as expected (routing to the Internet for itself and PC#2) for some time
(roughly anywhere from 0 to 30 minutes), but always eventually hangs.
It's then not possible to ping the ADSL modem.

The hang happens regardless of whether the new (PC#2) system is booted
or not.

The PC#1 ath0 wireless connection has been woking flawlessly (without
the firewall and NAT changs) for nearly a year (originally under FreeBSD
6.0 with Sam Lefflers ath patches) and more recently on FreeBSD 6.1.

Can anybody spot anything obviously wrong with the new setup, or know of
any bug reports that might impact a NATing gateway on a wireless connection?

I have also recently discovered the link goes up and down every 20 or 30
minutes with what looks like a DHCP lease renewal.  This extracted from
/var/log/messages:

Sep 13 19:42:21 kt400 kernel: ath0: link state changed to DOWN
Sep 13 19:42:23 kt400 kernel: ath0: link state changed to UP
Sep 13 19:42:23 kt400 dhclient: New IP Address (ath0): 192.168.1.64
Sep 13 19:42:23 kt400 dhclient: New Subnet Mask (ath0): 255.255.255.0
Sep 13 19:42:23 kt400 dhclient: New Broadcast Address (ath0): 192.168.1.255
Sep 13 19:42:23 kt400 dhclient: New Routers (ath0): 192.168.1.1
Sep 13 20:12:21 kt400 kernel: ath0: link state changed to DOWN
Sep 13 20:12:23 kt400 kernel: ath0: link state changed to UP
Sep 13 20:12:23 kt400 dhclient: New IP Address (ath0): 192.168.1.64
Sep 13 20:12:23 kt400 dhclient: New Subnet Mask (ath0): 255.255.255.0
Sep 13 20:12:23 kt400 dhclient: New Broadcast Address (ath0): 192.168.1.255
Sep 13 20:12:23 kt400 dhclient: New Routers (ath0): 192.168.1.1
Sep 13 21:32:21 kt400 kernel: ath0: link state changed to DOWN
Sep 13 21:32:24 kt400 kernel: ath0: link state changed to UP

Looks like a smoking gun?  Is this likely to upset the firewall/NATing?

[I have not yet had a chance to correlate the hang with the lease renewal,
but will test that tomorrow.]

In the kernel config file I have added:

options IPFIREWALL
options IPDIVERT

In /etc/rc.conf I have:

# See also /etc/wpa_supplicant.conf
ifconfig_ath0="WPA DHCP"
# Private x-over to printer
ifconfig_rl0="inet kt400pr netmask 255.255.255.0 broadcast 10.0.0.255"
# Private x-over to Dell 350 (PC#2)
ifconfig_sk0="inet gbkt400 netmask 255.255.255.0 broadcast 192.168.2.255"
# These added for firewall/NATing
gateway_enable="YES"
firewall_enable="YES"
firewall_type="OPEN"
natd_enable="YES"
natd_interface="ath0"
natd_flags=""

[kt400.145] cat /etc/wpa_supplicant.conf
network={
    ssid="linksys"
    key_mgmt=NONE
    wep_key0=xxxxxxxxxx
    wep_tx_keyidx=0
}

[kt400.146] ifconfig -a
sk0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=8<VLAN_MTU>
inet6 fe80::215:e9ff:feb0:e5b0%sk0 prefixlen 64 scopeid 0x1
inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255
ether 00:15:e9:b0:e5:b0
media: Ethernet autoselect (none)
status: no carrier

ath0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet6 fe80::20f:b5ff:fef6:28eb%ath0 prefixlen 64 scopeid 0x2
inet 192.168.1.64 netmask 0xffffff00 broadcast 192.168.1.255
ether 00:0f:b5:f6:28:eb
media: IEEE 802.11 Wireless Ethernet autoselect (DS/11Mbps)
status: associated
ssid linksys channel 11 bssid 00:14:bf:7a:57:94
authmode OPEN privacy ON deftxkey 1 wepkey 1:40-bit txpowmax 37
protmode CTS burst roaming MANUAL bintval 100

rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=8<VLAN_MTU>
inet6 fe80::220:edff:fe70:471a%rl0 prefixlen 64 scopeid 0x3
inet 10.0.0.254 netmask 0xffffff00 broadcast 10.0.0.255
ether 00:20:ed:70:47:1a
media: Ethernet autoselect (none)
status: no carrier

fwe0: flags=108802<BROADCAST,SIMPLEX,MULTICAST,NEEDSGIANT> mtu 1500
options=8<VLAN_MTU>
ether 02:00:20:71:b9:a6
ch 1 dma -1
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5
inet 127.0.0.1 netmask 0xff000000


Thanks,


-- 
Phil

I don't do drugs anymore 'cause I find I get the same effect just by standing
up really fast.
        -- Johnathan Katz


More information about the freebsd-net mailing list