Using FreeBSD as a router
Steffen Schumacher
steffen at schumacher.dk
Wed Aug 22 05:54:34 PDT 2007
On 22.08.2007 12:30:54 +0100, Tom Judge wrote:
> Steffen Schumacher wrote:
>> Hi!
>> This may b the wrong list, but you might know the right one..
>> I'm using the port quagge (zebra spin-off) in order to run bgp
>> off of two freebsd boxes, serving as routers.
>> They receive a default candidate from bgp: a/b.
>> The aim is to configure a static default with a next-hop of a/b.
>> This way the isp doesn't have to announce a 0/0, and I will still
>> have a default pointing the right way.
>> (I'm getting the a/b in from two separate lines for redundancy).
>> My problem is that I can't make the default work.
>> I use 'route default a/b' which actually shows up in 'netstat -rnf inet'
>> but it still doesn't work.
>> I've enclosed a lot of debug output.
>> Can anyone point me in the right direction?
>> Debug output:
>> g3# route add default 195.249.0.0
>> add net default: gateway 195.249.0.0
>
> Firstly this address is not a valid host address it is a network address.
> as shown by the routing entry below. Secondly your default gateway must be
> on your local network segment to work however 195.249.0/16 is behind the
> router 131.164.191.1.
>
> 195.249.0/16 131.164.191.1 UG1 1 12 vlan7
>
> Perhaps your default gateway should be 131.164.191.1 ??
>
Yes - ultimately that should be my gateway, but I want FreeBSD to realize
this by looking at the 195.249.0/16 route.
The thing is that 195.249.0/16 will also be seen from 131.164.191.2 but with
a lower localpref, making 131.164.191.1 the best choice. This way if .1 dies,
195.249.0/16 should be routed towards .2, and ultimately my default should go
at .2 also.
This is the goal - to make the default move to .2 if .1 is dead, and back when
1. comes back up again.
I don't think it matters if I use 195.249.0.0 or 195.249.1.1, since the router
receiving the packets will do their own routing lookup. Whats important is only
getting the next-hop mac/if for the default route, and that should be available
from the 195.249.0/16 route.
/Steffen
> Tom
>
>> g3# netstat -rnf inet
>> Routing tables
>> Internet:
>> Destination Gateway Flags Refs Use Netif Expire
>> default 195.249.0.0 UGS 0 0 vlan7
>> 127.0.0.1 127.0.0.1 UH 0 725 lo0
>> 131.164.191/29 link#10 UC 0 0 vlan7
>> 131.164.191.1 00:12:1e:f0:a0:fe UHLW 2 33782 vlan7 260
>> 131.164.191.2 00:0f:34:62:27:38 UHLW 1 5927 vlan7 1127
>> 131.164.191.3 00:0e:0c:b2:c6:55 UHLW 1 35 lo0
>> 131.164.191.9 192.168.0.2 UGH1 0 981 vlan1
>> 131.164.191.10 131.164.191.10 UH 0 4 lo0
>> 131.164.191.16/29 192.168.0.2 UG1 0 270 vlan1
>> 131.164.191.24 ff:ff:ff:ff:ff:ff UHLWb 1 50 vlan5 =>
>> 131.164.191.24/29 link#8 UC 0 0 vlan5
>> 131.164.191.27 00:0e:0c:b2:c6:55 UHLW 1 4 lo0
>> 131.164.191.31 ff:ff:ff:ff:ff:ff UHLWb 1 39 vlan5
>> 192.168.0 link#4 UC 0 0 vlan1
>> 192.168.0.2 00:0e:0c:bd:27:38 UHLW 3 12241 vlan1 1113
>> 192.168.10 link#5 UC 0 0 vlan2
>> 192.168.11 link#4 UC 0 0 vlan1
>> 192.168.20 link#6 UC 0 0 vlan3
>> 192.168.20.2 00:0e:0c:bd:27:38 UHLW 1 508 vlan3 31
>> 192.168.21 link#7 UC 0 0 vlan4
>> 195.249.0/16 131.164.191.1 UG1 1 12 vlan7
>> and some route lookups:
>> g3# route -vn get 0
>> u: inet 0.0.0.0; u: link ; RTM_GET: Report Metrics: len 168, pid: 0, seq
>> 1, errno 0, flags:<UP,GATEWAY,STATIC>
>> locks: inits: sockaddrs: <DST,NETMASK,IFP>
>> default default route to: default
>> destination: default
>> mask: default
>> gateway: 195.249.0.0
>> interface: vlan7
>> flags: <UP,GATEWAY,DONE,STATIC>
>> recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu
>> expire
>> 0 0 0 0 0 0 9504
>> 0 locks: inits: sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA>
>> default 195.249.0.0 default vlan7:0.e.c.b2.c6.55 131.164.191.3
>> g3# route -vn get 195.249.0.0
>> u: inet 195.249.0.0; u: link ; RTM_GET: Report Metrics: len 172, pid: 0,
>> seq 1, errno 0, flags:<UP,GATEWAY,STATIC>
>> locks: inits: sockaddrs: <DST,NETMASK,IFP>
>> 195.249.0.0 (0) 0 ffff route to: 195.249.0.0
>> destination: 195.249.0.0
>> mask: 255.255.0.0
>> gateway: 131.164.191.1
>> interface: vlan7
>> flags: <UP,GATEWAY,DONE,PROTO1>
>> recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu
>> expire
>> 0 0 0 0 0 0 9504
>> 0 locks: inits: sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA>
>> 195.249.0.0 131.164.191.1 255.255.0.0 vlan7:0.e.c.b2.c6.55 131.164.191.3
>> g3# route -vn get 131.164.191.1
>> u: inet 131.164.191.1; u: link ; RTM_GET: Report Metrics: len 164, pid: 0,
>> seq 1, errno 0, flags:<UP,GATEWAY,HOST,STATIC>
>> locks: inits: sockaddrs: <DST,IFP>
>> 131.164.191.1 route to: 131.164.191.1
>> destination: 131.164.191.1
>> interface: vlan7
>> flags: <UP,HOST,DONE,LLINFO,WASCLONED>
>> recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu
>> expire
>> 0 0 0 0 0 0 9504
>> 84 locks: inits: sockaddrs: <DST,GATEWAY,IFP,IFA>
>> 131.164.191.1 0.12.1e.f0.a0.fe vlan7:0.e.c.b2.c6.55 131.164.191.3
>> _______________________________________________
>> freebsd-isp at freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-isp
>> To unsubscribe, send any mail to "freebsd-isp-unsubscribe at freebsd.org"
>
> _______________________________________________
> freebsd-isp at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-isp
> To unsubscribe, send any mail to "freebsd-isp-unsubscribe at freebsd.org"
More information about the freebsd-isp
mailing list