Date: Mon, 7 Jan 2019 15:11:58 -0500 From: John Johnstone <jjohnstone@tridentusa.com> To: freebsd-questions@freebsd.org Cc: byrnejb@harte-lyne.ca Subject: Re: FreeBSD-11.2 routing and networks Message-ID: <800a0ad3-03b9-e392-1dd9-aff94e6ad27d@tridentusa.com> In-Reply-To: <1e5a2c5bdc65f1cf8e2c5d12d6cec983.squirrel@webmail.harte-lyne.ca> References: <1a466d730772d5ceb62ddfb204c92db5.squirrel@webmail.harte-lyne.ca> <CAAdA2WOmxwN=JQw0=9X8KeVqbEWaMaMKv3gNHNhyE4SbR737uw@mail.gmail.com> <1e5a2c5bdc65f1cf8e2c5d12d6cec983.squirrel@webmail.harte-lyne.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
On 1/7/19 11:15 AM, James B. Byrne via freebsd-questions wrote: > > > On Mon, January 7, 2019 11:06, Odhiambo Washington wrote: >> On Mon, 7 Jan 2019 at 19:01, James B. Byrne via freebsd-questions < >> freebsd-questions@freebsd.org> wrote: >> >>> I am working on a FreeBSD-11.2p17 host where I must change the IP >>> address and gateway frequently to carry out tests. Following making >>> such changes I have tried resetting the network interfaces and >>> routing tables by use of the command: >>> >>> service netif restart && service routing restart & >>> >>> However, I have discovered that this does not have the desired >>> effect and I am reduced to restarting the host system to make >>> such changes. > As it happens, for the moment this case is true, I do have console > access. However, the configuration testing that I am doing locally > will need to be applied to a remote host at some point, and the > console will not be an option. Is there no way to make FreeBSD reset > the network connection and routing tables remotely? Might be better to give more details about your "desired effect". Changes to IP address and gateway via ifconfig and route commands like ifconfig bce0 192.168.1.100 255.255.255.0 route [add][change] default 192.168.1.1 take place immediately. If you do an ifconfig and netstat -rn before your changes and then do them afterwards to verify you can confirm what's being done. There are some consequences that aren't obvious. One being the fact that the when you change the IP of an interface that is used for your default gateway, the default gateway is removed. You can see this by doing a netstat -rn, change your IP with ifconfig, and then do the netstat again. But if you were logged in remotely with IP routing taking place between you and your box via your default gateway, as soon as you change your IP, you'll orphan yourself because your box has no way to reach you because your default gateway is gone. I haven't used service netif restart remotely but I would expect that you would loose your connection if it was going through the default gateway just as if you issued the ifconfig command manually. It has the advantage though of taking the IP and gateway simultaneously from rc.conf which allows you to re-establish your connection to the box again after the changes are in effect. - John J.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?800a0ad3-03b9-e392-1dd9-aff94e6ad27d>