IPRoute2
#
Tips- iproute2
- Linux Advanced Routing & Traffic Control HOWTO
- IPROUTE2 Utility Suite Howto
- iproute2+tc notes
- iproute2 cheatsheet
- IPIP (IPv4 in IPv4), SIT (IPv6 in IPv4), IP6IP6 (IPv6 in IPv6), IPIP6 (IPv4 in IPv6), GRE (virtually anything in anything), and, in very recent versions, VTI (IPv4 in IPsec).
- Linux BRIDGE-STP-HOWTO
- 6. Set Up The Bridge
- STP(Spanning Tree Protocol)即生成树协议,标准为 IEEE802.1D-1998。
- STP 是一种二层冗余技术,利用 STA 算法构建一个逻辑上没有环路的树形网络拓扑结构,并且可以通过一定的方法实现路径冗余。
- Linux STP 介绍
- How can I bridge two interfaces with ip/iproute2?
- ip, ss, bridge, rtacct, rtmon, tc, ctstat, lnstat, nstat, routef, routel, rtstat, tipc, arpd, devlink, tc
- iproute2 rules and iptables NAT… what is the difference?
- Task-centered iproute2 user guide
Command | Desc |
---|---|
ip | |
ss | |
tc |
Legacy utility | Obsoleted by | Note |
---|---|---|
ifconfig | ip addr, ip link, ip -s | 地址、链路配置 |
route | ip route | 路由表 |
arp | ip neigh | Neighbors |
iptunnel | ip tunnel | 通道 |
nameif | ifrename, ip link set name | 网络设备别名 |
ipmaddr | ip maddr | Multicast |
netstat | ip -s, ss, ip route | 网络统计 |
net-tools | iproute2 |
---|---|
arp -a | ip neigh |
arp -v | ip -s neigh |
arp -s 192.168.1.1 1:2:3:4:5:6 | ip neigh add 192.168.1.1 lladdr 1:2:3:4:5:6 dev eth1 |
arp -i eth1 -d 192.168.1.1 | ip neigh del 192.168.1.1 dev eth1 |
ifconfig -a | ip addr |
ifconfig eth0 down | ip link set eth0 down |
ifconfig eth0 up | ip link set eth0 up |
ifconfig eth0 192.168.1.1 | ip addr add 192.168.1.1/24 dev eth0 |
ifconfig eth0 netmask 255.255.255.0 | ip addr add 192.168.1.1/24 dev eth0 |
ifconfig eth0 mtu 9000 | ip link set eth0 mtu 9000 |
ifconfig eth0:0 192.168.1.2 | ip addr add 192.168.1.2/24 dev eth0 |
netstat | ss |
netstat -neopa | ss -neopa |
netstat -g | ip maddr |
route | ip route |
route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0 | ip route add 192.168.1.0/24 dev eth0 |
route add default gw 192.168.1.1 | ip route add default via 192.168.1.1 |
#
bridge- docker/libnetwork#2310 - docker 不能在不影响 docker0 的前提下使用现有的 bridge 网口
- docker network macvlan
#
veth - Virtual Ethernet Device - 虚拟以太网设备#
相同网口进出#
table- Table 映射配置
/etc/iproute2/rt_tables
- local
- 特殊表
- 包含高优先的本地路由和广播地址
- main
- 包含所有非策略路由
- default
- 空的
#
rule- routing policy database - RPDB - 路由策略数据库
- ip-rule.8
- 传统路由基于目标地址,策略路由可基于包的其他字段
- 来源地址、IP 协议、端口、包内容
- rule=selector+action predicate
- 使用降序 - 数字越低越优先
- 类型
- unicast
- blackhole
- unreachable
- prohibit
- nat
#
mark- iproute rt_table and mark not working on linux
- https://superuser.com/questions/950031/routing-subnet-to-specific-routing-table-with-fwmark-direct-to-isp-and-vpn