I have a DSL modem which I use on a FreeBSD host to access the Internet; I use
When FreeBSD first comes up, the host in question has non-DSL ip address 10.0.0.5, just as I want it.
Then, when I want to add access to the Internet, I do:
... and I have Internet access, and
Then, later, I wish to remove bge0's access to the Internet. So when I do:
... things are exactly as I want: I no longer have access to the Internet, and 10.0.0.5 still remains.
But I also have to kill
Just doing the
So, to summarize:
And the question is this: is there a more, um, canonical, more correct, less klugey way than the two-step step 3 above to remove Internet access in such a way that I can do steps 2 and 3 repeatedly?
EDIT: (The interface name and the IP addresses shown in this question are simplified for clarity.)
dhclient for this with no problem. But there's a wrinkle. The wrinkle is that I want to have, say, bge0 always have a purely local IP address, and sometimes have access to the Internet with an IP address provided by dhclient.When FreeBSD first comes up, the host in question has non-DSL ip address 10.0.0.5, just as I want it.
Then, when I want to add access to the Internet, I do:
Code:
dhclient bge0
ifconfig shows addresses 10.0.0.5 and 192.68.8.113 associated with bge0. This is just fine.Then, later, I wish to remove bge0's access to the Internet. So when I do:
Code:
ifconfig bge0 192.168.8.113 -alias
But I also have to kill
dhclient, because if I don't, then later when I want to do dhclient bge0 again, I get an error message patiently explaining to me that dhclient is already running.Just doing the
-alias is not sufficient. Just killing (HUP, TERM, KILL, it doesn't matter which) dhclient is not sufficient, because ifconfig shows, and experimentation confirms, that Internet access is still present.So, to summarize:
- When FreeBSD comes up, bge0 is always associated with local address 10.0.0.5.
- When I want to add Internet connectivity to bge0, I say
dhclient bge0. - When I want to remove Internet connectivity from bge0, I say
ifconfig bge0 192.168.8.113 -alias, followed by killing thedhclientprocess by hand.
And the question is this: is there a more, um, canonical, more correct, less klugey way than the two-step step 3 above to remove Internet access in such a way that I can do steps 2 and 3 repeatedly?
EDIT: (The interface name and the IP addresses shown in this question are simplified for clarity.)