Difference between revisions of "Ip (command)"

From wikieduonline
Jump to navigation Jump to search
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Draft}}
+
{{lowercase}}
 +
<code>ip</code> command show / manipulate routing, network devices, interfaces and [[tunnels]].
  
* https://man7.org/linux/man-pages/man8/ip-link.8.html
+
* Man page: https://man7.org/linux/man-pages/man8/ip.8.html
 +
* <code>[[ip link]]</code> https://man7.org/linux/man-pages/man8/ip-link.8.html
  
  
Line 8: Line 10:
 
* <code>[[ip route add]]</code>
 
* <code>[[ip route add]]</code>
 
* <code>[[ip route]] del default</code>
 
* <code>[[ip route]] del default</code>
 +
 +
 +
* <code>[[ip address show]]</code>
  
  
Line 19: Line 24:
 
  ip route add 1.2.3.4/24 via <router> dev eth4 table <name>
 
  ip route add 1.2.3.4/24 via <router> dev eth4 table <name>
  
[[ip link]] add wg0 type [[wireguard]]
+
* <code>[[ip link]] add wg0 type [[wireguard]]</code>
 
 
 
 
  
 +
* <code>[[ip rule]] add</code>
  
  
Line 31: 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>
  
* <code>ip route add default via 192.0.2.2 dev eth55</code>
+
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>
 +
 +
* <code>[[MACHINE_IP]]=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)</code>
  
 
== [[Cisco IOS]] ==
 
== [[Cisco IOS]] ==
Line 43: Line 49:
 
* <code>[[ip default-gateway]]</code>
 
* <code>[[ip default-gateway]]</code>
  
== Related commands ==
+
== Related terms ==
 
* <code>[[geoiplookup]]</code>
 
* <code>[[geoiplookup]]</code>
 
* <code>[[netplan]]</code>
 
* <code>[[netplan]]</code>
 
* <code>[[route]]</code>
 
* <code>[[route]]</code>
 +
* [[IP (address)]]
 +
* [[netsh]] ([[Windows]])
  
 
== See also ==
 
== See also ==

Latest revision as of 14:05, 15 August 2023

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


Linux[edit]



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[edit]

Related terms[edit]

See also[edit]

Advertising: