

He wrote more than 7k+ posts and helped numerous readers to master IT topics. Vivek Gite is the founder of nixCraft, the oldest running blog about Linux and open source. For more info see ip command man page by typing the following man command or help command:
#Opensuse route gateway how to#
This page showed you how to configure static routes using the ip command line options. See How to set up static IP address on Debian Linux 10/11 for more info. Restart networking service when using a Debian or Ubuntu Linux using the systemctl command: Finally, restart your network service on a CentOS/RHEL/Fedora Linux so they take effect: Whenever a computer tries to connect to a machine on a different network it will connect to the default network gateway and then the network gateway will route. Save and exit (close) the file in a vim text editor. # vim /etc/sysconfig/network-scripts/route-eth0 How to add a permanent static route using ip command on LinuxĮdit config file such as /etc/sysconfig/network-scripts/route-eth0 on a CentOS/RHEL/Fedora Linux for interface eth0 using a text editor such as nano command or vim command: Warning: Do not stop networking service over ssh session. Here is another example where I am setting up route for my VPN gateway: Once become a root user, setup a temporary route using the ip command: You must login as root user with the help of su command or sudo command: It will be called vpn within docker and Linux. Join the nixCraft community via RSS Feed, Email Newsletter or follow on Twitter.Ip route add Add a static route on Linux 1 docker network create 2 -d bridge 3 -o .namevpn 4 -subnet172.18.0.1/16 vpn The network create action creates a new interface on the host with 172.18.0.1/16 as subnet. Type the following command to sent all packets to the local network 192.168.1.0 directly through the device eth0:, enter: ip route add 192.168.1.0/24 dev eth0.

Display default routeįollowing three-command display the current routing table:ĭestination Gateway Genmask Flags Metric Ref Use Ifaceġ91.255.255.0 * 255.255.255.0 U 0 0 0 eth0ĭefault 191.255.255.1 0.0.0.0 UG 0 0 0 eth0 Without these options, route displays the current contents of the routing tables. When the add or del options are used, route modifies the routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig program. The route command manipulates the kernel’s IP routing tables.
