Difference between revisions of "Ip (command)"

From wikieduonline
Jump to navigation Jump to search
Line 35: Line 35:
 
* <code>ip route add default via 192.0.2.2 dev eth0</code>
 
* <code>ip route add default via 192.0.2.2 dev eth0</code>
  
* ip route add default via 192.0.2.2 dev eth55
+
ip route add default via 192.0.2.2 dev eth55
  Cannot find device "eth55"
+
Cannot find device "eth55"
  
 
* <code>[[ip -s neighbor list]]</code>
 
* <code>[[ip -s neighbor list]]</code>

Revision as of 06:59, 2 February 2023

ip command show / manipulate routing, network devices, interfaces and tunnels.


Linux



Policy based routing / Source routing policy:

ip route add from <source>/<mask> table <name> 
ip route add 1.2.3.4/24 via <router> dev eth4 table <name>


Set an IP address:

  • ip addr add 192.168.0.xx/24 dev eth0

Default gateway:

  • ip route add default via 192.0.2.2 dev eth0
ip route add default via 192.0.2.2 dev eth55
Cannot find device "eth55"
  • MACHINE_IP=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)

Cisco IOS

Related terms

See also

Advertising: