OpenSuse Leap 15 iproute2 basics

From Notes_Wiki
Revision as of 12:40, 14 July 2022 by Saurabh (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Home > Suse > OpenSuse Leap 15 > System Administration > Network configuration > iproute2 basics

Home > CentOS > CentOS 6.x > Network configuration > IP routing 2 configuration > iproute2 basics

There are a few older articles at IP routing 2 configuration

Also see CentOS 8.x iproute2 basics


In modern OS such as OpenSuse Leap 15, backward compatibility for older net-tools commands such as ifconfig, route, etc. has been removed. Hence it is necessary to use 'ip' commands for most of the network tasks.

Check current ip addresses

Instead of 'ifconfig' use:

ip addr show

to list all interfaces and all addresses assigned to various interfaces. Note that each interface can have multiple addresses (IPv4, IPv6) associated with it.


Assign ip address

To assign ip address instead of using 'ifconfig <dev> <address>/<netmask>' use:

ip addr add <address>/<netmask> dev <interface> 

For example, ip addr add 10.0.0.1/24 dev eth1

Use 'del' in place of 'add' to remove the address


See routing table

To see routing table instead of using 'route -n' use:

ip route show 


Set default gateway

To set default gateway instead of using 'route add default gw <gateway-ip> [<interface>]' use:

ip route add default via <gateway> dev <interface>

For example, ip route add default via 192.168.1.2 dev eth0


Add static route

To add static route instead of using 'route add -net <network>/<netmask> gw <gateway> [dev <interface>]' use:

ip route add <network>/<netmask> via <gateway> dev <interface>

For example, ip route add 172.16.32.0/24 via 192.168.1.1 dev eth0


See network state information

To see network state information instead of using 'netstat -l' use:

ss -l


See arp table

To see arp table instead of using 'arp -a -n' use:

ip neigh


Bring interface up

If in "ip addr show" output interface is showing down, adding just IP via "ip addr add" may not be enough to bring it up. To bring interface up use:

ip link set <interface-name> up

Where <interface-name> can be eth0, etc.


Refer:


Home > Suse > OpenSuse Leap 15 > System Administration > Network configuration > iproute2 basics

Home > CentOS > CentOS 6.x > Network configuration > IP routing 2 configuration > iproute2 basics