Linux ip --Show/manipulate routing, network devices, interface and tunnels

  1. Private IP addresses are the ones your WiFi box (and company intranet) provide. They are in the range of 10.x.x.x, 172.16.x.x-172.31.x.x, and 192.168.x.x, where x=0 to 255.
  2. 基本命令为“ip”,有些用户使用它来代替废弃的 ifconfig,route,netstat.

    ifconfig                                            --> ip addr or just ip a
    ifconfig <interface> up/down                        --> ip link set dev <interface> up/down
    ifconfig <interface> <ip> netmask <netmask>         --> ip addr add <ip>/<masklen> dev <interface>
    netstat -rn                                         --> ip route or just ip r
    route add -net <net> netmask <netmask> gw <gateway> --> ip r add <net>/<netmasklen> via <gateway>
    
  3. Creating and Listing network namespace : ip netns

  4. The default namespace is not included in ‘ip netns list’ output.

  5. <BROADCAST,MULTICAST,UP,LOWER_UP>, its meaning, please check 'netdevice'; LOWER_UPis a physical layer link flag (the layer below the network layer, whereIPis generally located).LOWER_UPindicates that an Ethernet cable was plugged in and that the device is connected to the network.

    LOWER_UPdiffers fromUP, which additionally requires the network interface to be enabled.

  6. Managing the ARP Table: ip neigh (link layer neighbour control, mostly ARP)

    1. Show local ARP cache: ip neigh show
    2. flush (delete) all dynamic ARP entries : ip neigh flush dev ens32
    3. add a static ARP entry for the specified IP and MAC address combination, available via eth0 – potentially dangerous! : ip neigh add 1.1.1.13 lladdr AA:BB:CC:DD:EE:FF dev eth0
    4. delete the static or dynamic ARP entry for the specified IP address – potentially dangerous! : ip n del 1.1.1.13
  7. When a Client is attempting to speak to a host in a foreign network, the Client will issue an ARP request for the Default Gateway’s IP address (Default gateway --- Nearest Router); ARP’s role is to help the client create the proper L2 header, based on the L3 header, in order to get the packet from one hop to the next.

    1. When a Client is speaking to a host in the _same _network, it will ARP for the IP address of the host When a Client is speaking to a host in a _different _network, it will ARP for the IP address of the Default Gateway
  8. MAC Address Tables (Used by Switch) is a mapping of mac address and switch port

  9. IP masquerading : IP伪装

  10. 网络路由(ip route)

    1. route traffic via 192.168.2.254 gateway for 192.168.2.0/24 network --- 通过192.168.2.254网关为192.168.2.0/24网络路由流量
    2. A static route is nothing but a way of specifying traffic that must not go through the default gateway. --- 静态路由只不过是一种指定流量不能通过默认网关的的方法。
  11. ff

Blogs

  1. Linux ip Command Examples
  2. The Linux ip Command – An Ostensive Overview
  3. ip output format
  4. Linux ip command (good)
  5. Host to Host through a Router(Good)

results matching ""

    No results matching ""