Net-tools to iproute2: Difference between revisions

From Leo's Notes
This page was last edited on 1 September 2019, at 05:09.
m Text replacement - " {{Navbox Linux}}" to ""
m Text replacement - "Category:Linux" to "Category:Linux{{Navbox Linux}}"
Line 32: Line 32:
* http://unix.stackexchange.com/questions/152331/how-can-i-create-a-virtual-ethernet-interface-on-a-machine-without-a-physical-ad
* http://unix.stackexchange.com/questions/152331/how-can-i-create-a-virtual-ethernet-interface-on-a-machine-without-a-physical-ad


[[Category:Linux]]{{Navbox Linux}}
[[Category:Linux]]{{Navbox Linux}}{{Navbox Linux}}
[[Category:Networking]]
[[Category:Networking]]

Revision as of 05:09, 1 September 2019

The following maps the deprecated network tools (ifconfig, route, netstat, etc) to the new ip command.

Old New
ifconfig ip addr
ifconfig $interface [up|down] ip link set dev $interface [up|down]
ifconfig $interface $ip netmask $netmask ip addr add $ip/$mask dev $interface
route add default gw $gateway ip route add default via $gateway
route add -net $net netmask $netmask gw $gateway ip route add $net/$mask via $gateway
route -n ip route

Like networking commands on switches and routers, you do not need to type the full command so long as what's entered can be uniquely identified. For example, ip address can be simplified to ip a and ip route can be simplified to ip r.

The ip address add $ip/$mask dev $interface will add additional IP addresses to the device. If it already has an existing IP address, you will need to use ip address del $ip/$mask dev $interface to remove it.

Some other commands: