Tech/OSS/iproute2

From lathama
< Tech‎ | OSS
Jump to navigation Jump to search

The command for managing networking called ip as of 2018 packaged as iproute2 is interesting and here are some examples. In these examples enp0s25 is an example interface.

Show addresses (To demonstrate the various options I listed many)
ip a
ip address
ip a show
ip address show
ip -4 a
ip -4 address
ip -6 a
ip -6 address
ip -4 a show
ip -4 address show
ip -6 a show
ip -6 address show
ip -6 a show interfacenamehere
Show interfaces
ip l
ip link
ip l show
ip link show
Show neighbors aka ARP table
ip n
Turn an interface up
ip link set enp0s25 up
Turn an interface down
ip link set enp0s25 down
Add a temporary IP address to an interface
ip a add 192.168.2.2/24 dev enp0s25
Delete an IP address on an interface
ip addr del 192.168.0.77/24 dev enp0s25
Add secondary or alias interface
ip addr add 192.168.2.2/24 dev enp0s25 label enp0s25:2
Discover how a packet would be routed
ip route get 8.8.8.8
Setup a bridge
ip link add name super_bridge type bridge
ip link set super_bridge up
Add interface to bridge
ip link set enp0s25 master super_bridge
List bridges
bridge l
ip link show type bridge
Delete interface from bridge
ip link set enp0s25 nomaster
Delete a bridge
ip link delete super_bridge type bridge
Add default route
ip route add default via 192.168.2.1
Add VLAN Interface
ip link add link enp1s0 name vlan15 type vlan id 15
Show VLANs
ip link show type vlan
cat /proc/net/vlan/config
Check for VLAN offloading on hardware
ethtool -k enp1s0 | grep vlan-offload
Show open or listening ports
ss -ltu
Show Ethernet Interface information
ethtool -i enp1s0
Example
driver: igb
version: 5.4.0-k
firmware-version:  0. 6-5
expansion-rom-version: 
bus-info: 0000:01:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

Shared network via Debian and NetworkManager

  1. Selecting the wired network on a system using wireless for Internet connection you can set the shared attribute in the IPv4 tab.
  2. On the client system you can manually set an IP, route, and resolvers to use the Internet.
Client Example
ip r add 10.42.0.1 dev enp0s25
ip r add default via 10.42.0.1
echo "nameserver 8.8.4.4" >> /etc/resolv.conf