Difference between revisions of "OpenSuse Leap 15 iproute2 basics"
m |
m |
||
Line 64: | Line 64: | ||
</pre> | </pre> | ||
==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: | |||
<pre> | |||
ip link set <interface-name> up | |||
</pre> | |||
Where <interface-name> can be eth0, etc. | |||
Revision as of 10:32, 11 November 2020
<yambe:breadcrumb self="iproute2 basics">IP routing 2 configuration|IP routing 2 configuration</yambe:breadcrumb> <yambe:breadcrumb self="iproute2 basics">OpenSuse_Leap_15_Network_configuration|Network configuration</yambe:breadcrumb>
OpenSuse Leap 15 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:
<yambe:breadcrumb self="iproute2 basics">IP routing 2 configuration|IP routing 2 configuration</yambe:breadcrumb> <yambe:breadcrumb self="iproute2 basics">OpenSuse_Leap_15_Network_configuration|Network configuration</yambe:breadcrumb>