Adding default Gateway in Linux SUSE

Changing the default route permanently in SuSe Linux

To make 192.168.2.1 as default route, add the following line into /etc/sysconfig/network/routes file. (Create a file if it does not exist.)

default 192.168.2.1 – –

Syntax: default xxx.xxx.xxx.xxx – –

Linux route add using route command

Route all traffic via 192.168.1.254 gateway connected via eth0 network interface:

# route add default gw 192.168.1.254 eth0

Linux route add using ip command

Just like above but with ip command:
# ip route add 192.168.1.0/24 dev eth0

 route add -net default gw gateway_ip_address

 
 

Change IP address

You can change ip address using ifconfig command itself. To set IP address 192.168.1.5, enter command:
# ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up
# ifconfig eth0

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s