Default route not working properly

This is on FreeBSD 14.2-RELEASE, using the RPI image (FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img.xz).

The default route isn't working, even if I remove and add it manually:

route add default 192.168.0.100

Trying to ping a remote host fails:

Code:
ping www.google.com
ping www.freebsd.org
PING web.geo.freebsd.org (96.47.72.77): 56 data bytes
^C
--- web.geo.freebsd.org ping statistics ---
4 packets transmitted, 0 packets received, 100.0% packet loss

traceroute also fails

Code:
traceroute -d www.freebsd.org
traceroute: findsaddr: failed to connect to peer for src addr selection.

I have the following in /etc/rc.conf:

Code:
ifconfig_DEFAULT="inet 192.168.0.231 netmask 255.255.255.0"
defaultrouter="192.168.0.100"

netstat -rn prints the following:

Code:
Routing tables

Internet:
Destination        Gateway            Flags         Netif Expire
default            192.168.0.100      UGS             lo0
127.0.0.1          link#1             UH              lo0
192.168.0.0/24     link#2             U               ue0
192.168.0.231      link#1             UHS             lo0

This is the output of ifconfig:

Code:
lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        inet 192.168.0.231 netmask 0xffffff00
        inet 127.0.0.1 netmask 0xff000000
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
        groups: lo
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
ue0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
        options=80009<RXCSUM,VLAN_MTU,LINKSTATE>
        ether b8:27:eb:07:7c:34
        inet 192.168.0.231 netmask 0xffffff00 broadcast 192.168.0.255
        inet6 fe80::ba27:ebff:fe07:7c34%ue0 prefixlen 64 scopeid 0x2
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

I guess I don't understand the function of "ifconfig_DEFAULT"?
 
remove the secondary IP address from your loopback interface. The lo0 should not have 192.168.0.231 ip.

lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384
options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
inet 192.168.0.231 netmask 0xffffff00
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
groups: lo
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
 
'man rc.conf' says

... a fallback variable ifconfig_DEFAULT may be configured. It will be
used for all interfaces with no ifconfig_<interface> variable.

& Phishfry was saying on this forum back in October that it wasn't working properly. I've found that it's OK for setting a default DHCP response in simple cases (perhaps because there's no reply when sending a dhcp request to the loopback interface? No idea.). I suspect that it's not OK when specifying an IP address because it really does apply it to 'all interfaces' including lo0. So you're forced to use

ifconfig_ue0="inet 192.168.0.231 netmask 255.255.255.0"
 
Back
Top