Re: default route problem



On Mon, 2008-11-13 at 11:44 -0500, Dan Williams wrote:
>ifconfig eth0 192.168.1.30/32 up
>/sbin/ip route add default dev eth0 via 192.168.1.1

OK, I have this working now in dhcpcd now :)
It was working in 3.2.3, but broken in 4.0 which had me confused.

We can then do this
ip a a 1.2.3.4/32 dev eth0
ip r a 10.255.255.1/32 dev eth0
ip r a default via 10.255.255.1 dev eth0

A real world example is 1&1 internet servers which have a DHCP server
setup which gives us this.
ip address = 1.2.3.4
netmask = 255.255.255.255
broadcast = 1.2.3.4
static route = 10.255.255.1/10.255.255.1
routers = 10.255.255.1

The code that handles netlink, adding and deleting addresses and routes
fully working with the above can be found here. 
http://roy.marples.name/projects/dhcpcd/browser/trunk/if-linux.c?rev=1097
lines 359-426 are pertinant to this discussion.

Of the whole file, only about 300 lines of it are needed just for
address and route management. Matching code for all the BSDs can be
found in if-bsd.c. The API is quite simple and could probably be adapted
for NM if there is interest - however the code is BSD licensed.

Thanks

Roy

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]