I read http://www.freebsd.org/doc/handbook/network-routing.html#network-routing-default and I'm still a little unclear on how FreeBSD automatically determines which interface is providing the default route.
I set up this FreeBSD configuration this morning to aid me in resolving my queries and this is the relevant aspect of my rc.conf:
And here's the output of my routing table (I made up the external address):
In this instance, the sis0 interface is configured for DHCP and is connected directly to a standard home internet connection and FreeBSD automatically assigned it flags "G" and "S".
I set up this FreeBSD configuration this morning to aid me in resolving my queries and this is the relevant aspect of my rc.conf:
Code:
gateway_enable="YES"
ifconfig_sis0="DHCP"
ifconfig_em0="inet 10.1.1.5 netmask 255.255.255.192"
defaultrouter=""
And here's the output of my routing table (I made up the external address):
Code:
Destination Gateway Flags Refs Use Netif Expire
default d215-251-233-1.hom UGS 0 90442 sis0
10.1.1.0/26 link#6 U 0 121839 em0
10.1.1.5 link#6 UHS 0 0 lo0
localhost link#10 UH 0 406 lo0
215.251.233.0/21 link#5 U 0 0 sis0
d215-251-170-96.ho link#5 UHS 0 0 lo0
In this instance, the sis0 interface is configured for DHCP and is connected directly to a standard home internet connection and FreeBSD automatically assigned it flags "G" and "S".
- How did FreeBSD determine that it should assign "G" flag to the internet connection and make it the default route? This is obviously what I want but I'm curious how it makes that determination.
- What happens when I have a second DHCP internet connection, how does FreeBSD determine which of those two to assign "G" and make the default route?
So concerning question 2, let's say this is my new rc.conf:
Code:gateway_enable="YES" ifconfig_sis0="DHCP" ifconfig_xl0="DHCP" ifconfig_em0="inet 10.1.1.5 netmask 255.255.255.192" defaultrouter=""
And let's say my new routing table is:
Code:Destination Gateway Flags Refs Use Netif Expire default d215-251-233-1.hom UGS 0 90442 sis0 10.1.1.0/26 link#6 U 0 121839 em0 10.1.1.5 link#6 UHS 0 0 lo0 localhost link#10 UH 0 406 lo0 222.216.241.0/24 link#7 U 0 12 xl0 222.216.241.224 link#7 UHS 0 0 lo0 215.251.233.0/21 link#5 U 0 0 sis0 d215-251-170-96.ho link#5 UHS 0 0 lo0
So now I have two DHCP addresses, 222.216.241.224 and 215.251.170.96, and FreeBSD has decided that the 222.216.241.224 is still the default. (These numbers are not mine, I basically made them up for this example)
- Let's say I'd rather it utilize 215.251.170.96, how do I advise my router to prioritize one NIC over the other? How can I say defaultrouter always = "xl0"?