From the course: Linux System Engineer: Networking and SSH

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Change the default gateway

Change the default gateway

From the course: Linux System Engineer: Networking and SSH

Start my 1-month free trial

Change the default gateway

- [Narrator] We'll change the default gateway using both the legacy route command and the newer IP command. To set the default gateway using the route command, first make sure the net-tools package is installed. We will also want to make sure the default gateway we specify is accessible in our network. Let's check our network first. Type in I-P, space, A-D-D-R, space, show and hit enter. We can see that my IP address is 192.168.0.19 with the /24 subnet mask. That means my network is 192.168.0. With this in mind, I will set my default gateway to 192.168.0.100. Type in clear, and then type in sudo route add default, gw, 192.168.0.100, and hit enter, and type in your password if you're prompted. If this default gateway isn't valid, you won't be able to access your VM remotely anymore, which is fine as we're using the virtual box console. Just be aware that if you're accessing a host remotely through the network, you'll need to use a valid default gateway, or you will not be able to…

Contents