ip - bunnyamin/bunnix GitHub Wiki

Address

Command Example Comment
Add static IP # ip addr add 192.168.1.1/24 dev <DEVICE> Before assigning IP address, ensure that device interface is enabled.
Add static IP and broadcast # ip addr add 192.168.1.100/24 brd + dev <DEVICE> Automatically set the broadcast address. Before assigning IP address, ensure that device interface is enabled.
Delete interface # ip addr del 192.168.1.1/24 dev <DEVICE>
Delete all interfaces # ip addr flush dev <DEVICE>
List addresses # ip addr show

ARP

Command Example
Add ip neighbor add <IP> lladdr <MAC> dev <dev> nud permanent
Delete ip neigh[bor] del <IP> dev <dev>

Broadcast

Command Example
Add broadcast # ip addr add brd 192.168.0.255 dev <DEVICE>

Device

Command Example
Enable # ip link set <DEVICE> up
Disable # ip link set <DEVICE> down
Link status $ ip link [show] [DEVICE]

Error, problem, troubleshooting

Error Cause Remedy
The interface does not "come up" "NO-CARRIER"; there is no physical connection. Ensure that the physical connection is not damaged or that the source is online.
NextHop device not up The device interface is not up. Enable device.

Gateway

The default is an alias for 0.0.0.0/0.

  • 0.0.0.0/1 overrides the default gateway 0.0.0.0/0.
Command Example Comment
Add gateway # ip route add 192.168.0.1 dev <DEVICE>
Add gateway # ip route add default via 192.168.0.101 dev <DEVICE>
Add gateway # ip route add 192.168.0.0/24 via 192.168.0.101 dev <DEVICE> Access network X via gateway Y on Network interface device Z.
Del gateway # ip route del <IP>/<CIDR>

Error, problem, troubleshooting

Error Cause Remedy
Nexthop has invalid gateway. The default Gateway is not on the same subnet as the interface.
RTNETLINK answers: File exists Two or more interfaces have assigned a Gateway.

Route

Command Example
List all routing tables $ ip route show table all
List all routing tables in a table layout $ routel
List all routing tables (-r) in a table layout with unresolved addresses (-n) $ netstat -rn
List assigned routes $ ip route show

Subnet

The addresses 192.168.1.2 and 192.168.2.1 cannot talk to each other if ... [the] subnet [is] 255.255.255.0. ... . ... [declare] the subnet mask to 255.255.0.0 or change the IP address of the 192.168.2.1 machine to 192.168.1.1 ... . ... Ethernet devices made in the last 10 or so years support auto MDI-X which eliminates the need for a crossover cable. Answer by Bert May 31 '14 at 16:30 to question How to connect two ubuntu computers with ethernet cable.

⚠️ **GitHub.com Fallback** ⚠️