linux:ipcommand
Table of Contents
IP command
Fingers still used to typing ifconfig? Here's what you need to know to get used to the new ip command. Or you could just read the man page….
ifconfig and ip compared
| NetTools | ip command |
|---|---|
| arp -a | ip neigh |
| arp -v | ip -s neigh |
| arp -i eth0 -d 192.168.10.11 | ip neigh del 192.168.10.11 dev eth0 |
| arp -s 192.168.10.11 11:22:33:44:55:66 | ip neigh add 192.168.10.11 addr 11:22:33:44:55:66 dev eth0 |
| ifconfig -a | ip addr |
| ifconfig eth0 up | ip link set eth0 up |
| ifconfig eth0 down | ip link set eth0 down |
| ifconfig eth0 192.168.10.11 | ip addr add 192.168.10.11/24 eth0 |
| ifconfgi eth0 netmash 255.255.255.0 | ip addr add 192.168.10.11/24 eth0 |
| ifconfig eth0:0 192.168.11.11 | ip addr add 192.168.11.11/24 eth0 |
| netstat | ss |
| netstat -neopa | ss -neopa |
| netstat -g | ip maddr |
| route | ip route |
| route add -net 192.168.11.0 netmask 255.255.255.0 dev eth1 | ip route add 192.168.11.0/24 dev eth1 |
| route add default gw 192.168.11.1 | ip route add default voa 192.168.11.1 |
Queries
| ip | Explaination |
|---|---|
| ip addr | ip addr sh eth0 - Show ip information for device eth0 |
| ip link | ip link sh dev eth0 - show link status |
| ip -s link - show stats for interfaces | |
| ip route | Show routing table information |
| ip neigh | Show arp table for neighbouring devices |
| ip help | Shows list of commands and their arguments |
| ip maddr | ip multicast info |
Modifying address or links status
| ip | Explaination |
|---|---|
| ip addr add | Add an ip address - ip add 192.168.10.11/24 dev eth2 |
| ip addr del | Remove an ip address |
| ip link set | Set the status of an interface, up, down and mtu |
ARP
| ip | Explaination |
|---|---|
| ip neigh add | Add ARP entry:- |
| ip neigh add 192.168.11.1 addr 11:22;33:44:55:66dev eth3 | |
| ip neigh del | Del an arp entry |
Routing
| ip | Explaination |
|---|---|
| ip route add | Adds a new line to the routing table |
| ip route add default via 192.168.10.1 dev eth2 | |
| ip route add 192.168.10.0/24 via 192.168.10.1 | |
| ip route add 192.168.10.0/24 via dev eth2 | |
| ip route del | Delete a route entry |
| ip route get | Get the path an address will take |
| ip route get 192.168.1.1 | |
| $ ip route get 1.1.1.1 | |
| 1.1.1.1 via 192.168.1.1 dev enp0s3 src 192.168.1.197 uid 1000 |
Multicast
| ip | Explaination |
|---|---|
| ip maddr add | Add a multicast address |
| ip maddr del | Del a multicast address |
This page has been accessed:-
Today: 1
Yesterday: 0
Until now: 355
linux/ipcommand.txt · Last modified: by 127.0.0.1
