Linux Networking Commands
Linux Networking Commands
Linux Networking Commands
In this memo, I’m showing Linux networking commands to remember as a network engineer/technician.
To show the IP address assigned to an interface:
1
ip address show
To assign an IP Address to an interface, for example, ens33:
1
ip address add 192.168.8.20/24 dev ens33
To delete an IP Address on an interface:
1
ip address del 192.168.8.20/24 dev ens33
To online or up an interface, for example, eth0:
1
ip link set eth0 up
To offline or down an interface:
1
ip link set eth0 down
To change an interface MTU, the default MTU is 1500:
1
ip link set eth0 mtu 9000
To add a default route:
1
ip route add default via 192.168.1.254 dev eth0
To add a route to 192.168.1.0/24 via the gateway at 192.168.1.254:
1
ip route add 192.168.1.0/24 via 192.168.1.254
Add a route to 192.168.1.0/24 that can be reached on the device:
1
ip route add 192.168.1.0/24 dev ens33
Delete the route for 192.168.1.0/24 via the gateway at 192.168.1.254:
1
ip route delete 192.168.1.0/24 via 192.168.1.254
This post is licensed under CC BY 4.0 by the author.