ifconfig and route problem.

Anton Blajev valqk at lozenetz.net
Tue Feb 24 08:58:00 PST 2004


Please stop flooding. :)
RTFM -> man ifconfig ; man route

you CAN'T change your NIC's ip whithough deleteing your default route.
why's that?
well... route add default 192.168.0.1
when you add default gw it must be reachable on your network.
when you change ip, you have to add ne w route because you;ve changed
network. 
aka you can patch ifconfig command to check if you change ip address to
other form your network(192.168.0.0 for example) and don't delete
default route... dunno ... I think ifconfig deletes it. not pretty sure.

a simple desicion will be a bash script:
---- ./chaddr.sh rl0 192.168.0.50 255.255.255.0 192.168.0.1
###############i-face ip           nmask          gw

#!/bin/sh
/sbin/ifconfig $0 $1 $3
/sbin/route add default 1$4




More information about the freebsd-net mailing list