network ip - ghdrako/doc_snipets GitHub Wiki
ip
This command is used to display or manipulate routing, devices, network devices, and tunnels. Although it is similar to ifconfig command but way too powerful including more functions and facilities in it.
This replaces the traditional ifconfig and route commands.
Display the IP address and other information about a network interface using the following command:-
$ ip addr show
$ ip address
$ ip a
For temporarily assigning IP Address to a specific network interface (eth0), use the following command:-
$ sudo ip addr add 195.162.54.2 dev eth0
For removing an assigned IP address from a network interface (eth0), use the following command:-
$ sudo ip addr del 195.162.54.15/24 dev eth0
$ ip neigh # Display the current neighbor table in the kernel
ip link - is for configuring, adding, and deleting network interfaces
$ ip link show # command to display all network interfaces on the system
$ man ip-link
ip address - to display addresses, bind new address or delete old ones.
$ ip address show dev enp0s8 #shows the IP address assigned to the network interface enp0s8
$ man ip-address
ip route - print or display the routing table.
The ip route add
command is used to add a new route to the routing table. The routing table is
a database that the kernel uses to determine how to route packets to their destinations.
The impact of the ip route add command is that it will allow the system to communicate with
devices on the 192.168.x.x/24 network.
The ip route add
command can be used to add routes to any network, not just local networks.
This can be useful for configuring routing between different networks or for routing packets over VPNs.
ip route add 192.168. /24 via 192.168 .1 # dds a route to the 192.168.x.0/24 subnet via the 192.168.x.x gateway.
netstat -tuln
$ ip route show # displays the contents of the routing table: and as default default trace
$ ip r
- default
- LLA(Link-Local Address) 169.254.0.0/16 - adres przeznaczony tylko do komunikacji z innymi adresami LLA w tym samym segmencie sieci
Ekwiwalent tego polecenia to
netstat -rn
route -n