Date: Mon, 7 Jan 2019 16:15:50 -0500 From: Mike Tancsa <mike@sentex.net> To: byrnejb@harte-lyne.ca, freebsd-questions@freebsd.org Subject: Re: FreeBSD-11.2 routing and networks Message-ID: <18cffec3-982f-08a7-dd1d-73a2572a827a@sentex.net> In-Reply-To: <1a466d730772d5ceb62ddfb204c92db5.squirrel@webmail.harte-lyne.ca> References: <1a466d730772d5ceb62ddfb204c92db5.squirrel@webmail.harte-lyne.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
On 1/7/2019 10:55 AM, James B. Byrne via freebsd-questions 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.=20 > Is there something else I should be doing? If the two networks are on the same vlan, Its probably easier to just manually use route and ifconfig. Also, when you change the IP (assuming you dont have another nic on a connected interface that you are logging in from), your network connection via ssh will drop.=C2=A0 Remember, pack= ets always follow a more specific route.=C2=A0 So lets say under normal circumstances your machine is 10.1.1.2/24 with a gw of 10.1.1.1 and you are logged in from 172.29.13.1.= your test network is 192.168.1.2/24 with a gw of 192.168.1.1. Rather than restart the network and delete the existing IPs from the interface, just do route add 172.29.13.0/24 10.1.1.1 ifconfig <inteface> 192.168.1.2/24 alias route change default 192.168.1.1 where interface is whatever your nic is (igb0,em0,re0 etc)... This way you still have a path back to your machine you are logged into, assuming 10.1.1.0/24 is still on the same vlan as your test IPs.. When you want to revert, route change default 10.1.1.1 and ifconfig <interface> 192.168.1.2/24 -alias =C2=A0=C2=A0=C2=A0 ---Mike --=20 ------------------- Mike Tancsa, tel +1 519 651 3400 x203 Sentex Communications, mike@sentex.net Providing Internet services since 1994 www.sentex.net Cambridge, Ontario Canada =20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?18cffec3-982f-08a7-dd1d-73a2572a827a>