2020.11.11星期三  正式班D26

14.2.2 ifconfig命令

  • ifconfig命令结果解释

    [root@ccc ~]# ifconfig eth0
    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    # 从flags可知该接口已启用,支持广播、组播
    # mtu:1500(最大输出单元1500字节)
    # UP:表示接口已启用
    # BROADCAST:表示主机支持广播
    # RUNNING:表示接口在工作中
    # MULTICAST:表示主机支持多播
    inet 192.168.29.55 netmask 255.255.255.0 broadcast 192.168.29.255
    # ipv4地址 子网掩码 广播地址
    inet6 fe80::20c:29ff:fec0:5db3 prefixlen 64 scopeid 0x20<link>
    # ipv6地址 掩码长度 作用域,link表示仅该接口有效
    ether 00:0c:29:c0:5d:b3 txqueuelen 1000 (Ethernet)
    # 网卡接口的MAC地址 输出队列长度 接口类型为Ethernet
    RX packets 1706 bytes 156657 (152.9 KiB)
    # 表示开机后此接口累计接收的报文个数,总字节数
    RX errors 0 dropped 0 overruns 0 frame 0
    # 表示开机后此接口累计接收的报文错误数,丢弃数,溢出数(速度过快而丢失的数据包数),冲突的帧数
    TX packets 1249 bytes 121636 (118.7 KiB)
    # 表示开机后此接口累计发送的报文数,总字节数
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
    # 表示开机后此接口累计发送的报文错误数,丢弃数,溢出数(速度过快而丢失的数据包数)
    # carrier 载荷数(发生carrier错误而丢失的数据包数)
    # collisions 冲突数
  • 补充

    # 1、全双工与半双工(目前网卡一般采用全双工模式)
    全双工(Full-Duplex Transmissions)指交换机在发数据的同时也能接收数据,两者同步进行
    全双工延迟小、冲突少、速度快
    半双工指同一时间只有一个动作发生 # CRC
    CRC即循环冗余校验码(Cyclic Redundancy Check)是数据通信领域常用的查错校验码
    特征:信息字段和校验字段的长度可以任意选定。接收设备执行类似的算法,以保证数据传输的正确性和完整性 # 网卡工作原理
    网卡发包:
    1、ip包+14字节的mac头-->数据帧frame
    2、frame拷贝到网卡芯片内的缓冲区,由网卡处理
    3、网卡芯片为frame添加头部同步信息和CRC校验称为可发送的packet,发送该packet
    网卡收包:
    1、网卡包packet到达网卡,网卡先检查packet的CRC校验,保证其完整和正确性,去掉头得frame
    2、网卡将frame拷贝到网卡内部的FIFO缓冲区
    3、网卡驱动程序产生硬件中断,把frame从网卡拷贝到内存,剩下交给内核 网卡丢包:
    1、内核通常要快速的将网络数据包拷贝到系统内存
    2、网卡上接收的网络数据包的缓存大小固定,相比系统内存小得多
    12其一被延迟都会造成网卡FIFO缓存溢出
    进入的数据包占满了网卡的缓存,后续的包只能被丢弃,是ifconfig中overrun的来源
  • 解决丢包问题

    # 丢包排查
    网卡工作在数据链路层,数据链路层会做一些校验,封装成帧。
    可以查看校验是否出错,确定传输是否有问题
    其次可以从软件方面,查看是否因为缓冲区太小而丢包 # 1 检查硬件情况
    # 1.1 查看工作模式是否正常
    [root@ccc ~]# ethtool eth0 | egrep -i 'speed|duplex'
    Speed: 1000Mb/s
    Duplex: Full
    # 1.2 查看CRC校验是否正常
    [root@ccc ~]# ethtool -S eth0 | grep crc
    rx_crc_errors: 0
    # Speed、Duplex、CRC都没问题,基本排除物理层面的干扰 # 2、通过ifconfig可以看到overruns是否一致增大,如果一直增大
    [root@ccc ~]# for i in `seq 1 100`; do ifconfig eth0 | grep RX | grep overruns; sleep 1;done
    RX errors 0 dropped 0 overruns 0 frame 0
    RX errors 0 dropped 0 overruns 0 frame 0 # 3、调整网卡缓冲区
    [root@ccc ~]# ethtool -g eth0
    Ring parameters for eth0:
    Pre-set maximums: # 最大可以设置的值
    RX: 4096
    RX Mini: 0
    RX Jumbo: 0
    TX: 4096
    Current hardware settings: # 当前设置的值
    RX: 256
    RX Mini: 0
    RX Jumbo: 0
    TX: 256
    [root@ccc ~]# ethtool -G eth0 rx 2048 # 调大
    [root@ccc ~]# ethtool -G eth0 tx 2048 # 调大
    [root@ccc ~]# ethtool -g eth0
    Ring parameters for eth0:
    Pre-set maximums:
    RX: 4096
    RX Mini: 0
    RX Jumbo: 0
    TX: 4096
    Current hardware settings:
    RX: 2048
    RX Mini: 0
    RX Jumbo: 0
    TX: 2048
  • ethtool网卡降速

    [root@ccc ~]# ethtool -s eth0 speed 100 duplex full
    [root@ccc ~]# ethtool -s eth0 speed 100 duplex full autoneg off
    # 关闭自适应才能成功
    [root@ccc ~]# ethtool eth0 # 查看 想要永久配置需将上述ethtool设置写入配置文件/etc/rc.local
    必须加x权限
    [root@ccc ~]# chmod +x /etc/rc.d/rc.local

14.3 路由route

14.3.1 交换与路由

  • 交换

    指同网络访问,两台交换机连接在同一个交换机上,配置同网段的不同IP就可以直接通讯。

  • 一台主机能被当成路由器的必要条件

    1、至少有两块网卡分别连接两个不同的网段

    2、开启路由转发功能

    ​ echo 1 > /proc/sys/net/ipv4/ip_forward

    3、在该linux主机上添加正确的路由规则/策略

    ​ route

    4、其他主机若想要上述linux主机帮自己转发数据包,必须将自己的gw指定成上述linux主机的ip地址

14.3.2 Linux处理数据包的过程

  • 向外界主机发送数据时,在他从网卡流入后需要对他做路由决策,根据其目标决定是流入本机的用户空间还是在内核空间就直接转发给其他主机

    # 1、是流入本机用户空间的数据
    数据会从内核空间流入用户空间(被应用程序接受并处理)
    # 2、不是流入本机用户空间的数据,只经过本机把数据包转发给其他主机
    需开启Linux主机的路由转发功能
    # 临时开启方式一
    echo 1 > /proc/sys/net/ipv4/ip_forward
    # 临时开启方式二
    sysctl -w net.ipv4.ip_forward=1
    # 永久开启改配置文件
    echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/ip_forward.conf

14.3.3 网关/路由

  • 主机路由:掩码位32位,Destination精确到某一台主机

    通常主机路由是直接指明到某台具体主机怎么走,主机路由也就是所谓的静态路由

  • 网络路由:掩码位小于32位,Destination精确到某一网段的主机

    网络路由指明到某类网络怎么走

  • 默认路由:掩码为0

    不走主机路由和网络路由的全都走默认路由

    操作系统设置的默认路由一般也称网关

    # 1、在Linux中,路由条目的优先级确定方式是先匹配掩码位长度,越长优先级越高
    # 2、路由条目掩码长度相同时,比较节点之间的管理距离(如metric),短的优先
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    0.0.0.0 192.168.29.1 0.0.0.0 UG 100 0 0 eth0
    192.168.29.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0

14.3.4 route命令

  • route命令由于显示和管理路由表

  • route add 增加路由条目,route del 减少路由条目

  • route -n 显示路由表信息,-n选项表示不解析主机名

    route [add/del] [-host/-net/default] [address[/mask]] [netmask] [gw] [dev]
    
    add/del		# 增加或删除路由条目
    -net # 增肌或删除的是一条网络路由
    -host # 增加或删除的是一条主机路由
    default # 增加或删除的是一条默认路由
    netmask # 明确使用netmask关键字指定掩码,也可直接在地址上用cidr格式的掩码,即IP/MASK
    gw # 指定下一跳的地址(下一跳的地址必须是能达到的,且一般是与本网段直连的接口)
    dev # 强制将路由条目关联到指定的接口上(一般内核会自动判断路由条目应该关联到那个网络接口) # route命令添加的都是临时生效的
  • 添加和删除默认路由

    [root@ccc ~]# route add default gw 192.168.29.1
    [root@ccc ~]# route del default
    [root@ccc ~]# route del default gw 192.168.29.1
    # 如果有多条默认路由,再加上gw可唯一删除指定条目
    # 默认路由的destination和gemask都是0.0.0.0因此可用default代替
  • 添加和删除网络路由

    [root@ccc ~]# route add -net 192.168.29.11/24 gw 192.168.29.55
    [root@ccc ~]# route add -net 192.168.29.11 netmask 255.255.255.255 gw 192.168.29.55
    [root@ccc ~]# route del -net 192.168.29.11/24
    [root@ccc ~]# route del -net 192.168.29.11 netmask 255.255.255.255 gw 192.168.29.55
  • 添加和删除主机路由

    [root@ccc ~]# route add -host 192.168.29.11/24 gw 192.168.29.55
    [root@ccc ~]# route add -host 192.168.29.11/24

14.3.5 配置永久路由

  • 创建配置文件

    /etc/sysconfig/network-scripts/route-ethX

    要从哪个接口出去X就是几

  • 配置文件内容

    DEST via nexthop

    # 默认路由
    default via 192.168.100.1
    # 网段路由
    192.168.10.0/24 via 192.168.100.1
    # 主机路由
    192.168.100.52/32 via 192.168.100.33 dev eth1

14.3.6 测试

  • 环境

    交换机 IP 交换机 IP
    交换机1 1.1.1.0 交换机2 2.2.2.0
    交换机3 3.3.3.0 交换机4 4.4.4.0
    主机名 网卡 IP 主机 网卡 IP
    主机1 eth0 1.1.1.6 主机2 eth0 1.1.1.2
    eth1 2.2.2.2
    主机3 eth0 2.2.2.3 主机4 eth0 3.3.3.4
    eth1 3.3.3.3 eth1 4.4.4.4
  • 主机1ping主机2网卡1:1.1.1.6------------->1.1.1.2

    =============================主机1==============================
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    [root@ccc ~]# ping 1.1.1.2
    PING 1.1.1.2 (1.1.1.2) 56(84) bytes of data.
    64 bytes from 1.1.1.2: icmp_seq=1 ttl=64 time=1.05 ms
    ^C
    --- 1.1.1.2 ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2003ms
    rtt min/avg/max/mdev = 0.326/0.805/1.052/0.338 ms
  • 主机1ping主机2网卡2:1.1.1.6------------->2.2.2.2

    =============================主机1==============================
    [root@ccc ~]# ping -c 2 2.2.2.2
    connect: 网络不可达
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    [root@ccc ~]# route add -net 2.2.2.0/24 dev eth0
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    [root@ccc ~]# ping -c 2 2.2.2.2
    PING 2.2.2.2 (2.2.2.2) 56(84) bytes of data.
    64 bytes from 2.2.2.2: icmp_seq=1 ttl=64 time=0.552 ms
    64 bytes from 2.2.2.2: icmp_seq=2 ttl=64 time=0.354 ms
    --- 2.2.2.2 ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 1000ms
    rtt min/avg/max/mdev = 0.354/0.453/0.552/0.099 ms
  • 主机1ping主机3网卡1:1.1.1.6------------->2.2.2.3

    =============================主机1==============================
    [root@ccc ~]# ping -c 2 2.2.2.3
    PING 2.2.2.3 (2.2.2.3) 56(84) bytes of data.
    From 1.1.1.6 icmp_seq=1 Destination Host Unreachable
    From 1.1.1.6 icmp_seq=2 Destination Host Unreachable
    --- 2.2.2.3 ping statistics ---
    2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 1001ms pipe 2
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    [root@ccc ~]# route add -net 2.2.2.0/24 gw 1.1.1.2 dev eth0
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    2.2.2.0 1.1.1.2 255.255.255.0 UG 0 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    =============================主机2==============================
    [root@ccc ~]# echo 1 > /proc/sys/net/ipv4/ip_forward
    =============================主机3==============================
    [root@ccc ~]# route add -net 1.1.1.0/24 gw 2.2.2.2 dev eth0
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 2.2.2.2 255.255.255.0 UG 0 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    3.3.3.0 0.0.0.0 255.255.255.0 U 101 0 0 eth1
    =============================主机1==============================
    [root@ccc ~]# ping -c 2 2.2.2.3
    PING 2.2.2.3 (2.2.2.3) 56(84) bytes of data.
    64 bytes from 2.2.2.3: icmp_seq=1 ttl=63 time=1.60 ms
    64 bytes from 2.2.2.3: icmp_seq=2 ttl=63 time=0.657 ms
    --- 2.2.2.3 ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 1000ms
    rtt min/avg/max/mdev = 0.657/1.129/1.602/0.473 ms
  • 主机1ping主机3网卡2:1.1.1.6------------->3.3.3.3

    =============================主机1==============================
    [root@ccc ~]# ping -c 2 3.3.3.3
    connect: 网络不可达
    [root@ccc ~]# route add -net 3.3.3.0/24 gw 1.1.1.2 dev eth0
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    2.2.2.0 1.1.1.2 255.255.255.0 UG 0 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    3.3.3.0 1.1.1.2 255.255.255.0 UG 0 0 0 eth0
    =============================主机2==============================
    [root@ccc ~]# route add -net 3.3.3.0/24 dev eth1
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 101 0 0 eth1
    3.3.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
    =============================主机3==============================
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 2.2.2.2 255.255.255.0 UG 0 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    3.3.3.0 0.0.0.0 255.255.255.0 U 101 0 0 eth1
    =============================主机1==============================
    [root@ccc ~]# ping -c 2 3.3.3.3
    PING 3.3.3.3 (3.3.3.3) 56(84) bytes of data.
    64 bytes from 3.3.3.3: icmp_seq=1 ttl=63 time=1.44 ms
    64 bytes from 3.3.3.3: icmp_seq=2 ttl=63 time=0.797 ms
    --- 3.3.3.3 ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 1002ms
    rtt min/avg/max/mdev = 0.797/1.121/1.446/0.326 ms
  • 主机1ping主机4网卡1:1.1.1.6------------->3.3.3.4

    =============================主机1==============================
    [root@ccc ~]# ping -c 2 3.3.3.4
    PING 3.3.3.4 (3.3.3.4) 56(84) bytes of data.
    From 1.1.1.2 icmp_seq=1 Destination Host Unreachable
    From 1.1.1.2 icmp_seq=2 Destination Host Unreachable
    --- 3.3.3.4 ping statistics ---
    2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 1000ms
    pipe 2
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    2.2.2.0 1.1.1.2 255.255.255.0 UG 0 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    3.3.3.0 1.1.1.2 255.255.255.0 UG 0 0 0 eth0
    =============================主机2==============================
    [root@ccc ~]# route add -net 3.3.3.0/24 gw 2.2.2.3 dev eth1
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 101 0 0 eth1
    3.3.3.0 2.2.2.3 255.255.255.0 UG 0 0 0 eth1
    3.3.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
    =============================主机3==============================
    [root@ccc ~]# echo 1 > /proc/sys/net/ipv4/ip_forward
    =============================主机4==============================
    [root@ccc ~]# route add -net 1.1.1.0/24 gw 3.3.3.3 dev eth0
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 3.3.3.3 255.255.255.0 UG 0 0 0 eth0
    3.3.3.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    4.4.4.0 0.0.0.0 255.255.255.0 U 101 0 0 eth1
    =============================主机1==============================
    [root@ccc ~]# ping -c 2 3.3.3.4
    PING 3.3.3.4 (3.3.3.4) 56(84) bytes of data.
    64 bytes from 3.3.3.4: icmp_seq=1 ttl=62 time=1.71 ms
    64 bytes from 3.3.3.4: icmp_seq=2 ttl=62 time=1.16 ms --- 3.3.3.4 ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 1002ms
    rtt min/avg/max/mdev = 1.162/1.440/1.718/0.278 ms
  • 主机1ping主机4网卡2:1.1.1.6------------->4.4.4.4

    =============================主机1==============================
    [root@ccc ~]# route add -net 4.4.4.0/24 gw 1.1.1.2 dev eth0
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    2.2.2.0 1.1.1.2 255.255.255.0 UG 0 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    3.3.3.0 1.1.1.2 255.255.255.0 UG 0 0 0 eth0
    4.4.4.0 1.1.1.2 255.255.255.0 UG 0 0 0 eth0
    =============================主机2==============================
    [root@ccc ~]# route add -net 4.4.4.0/24 gw 2.2.2.3 dev eth1
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 101 0 0 eth1
    3.3.3.0 2.2.2.3 255.255.255.0 UG 0 0 0 eth1
    3.3.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
    4.4.4.0 2.2.2.3 255.255.255.0 UG 0 0 0 eth1
    =============================主机3==============================
    [root@ccc ~]# route add -net 4.4.4.0/24 dev eth1
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 2.2.2.2 255.255.255.0 UG 0 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    3.3.3.0 0.0.0.0 255.255.255.0 U 101 0 0 eth1
    4.4.4.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
    =============================主机4==============================
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 3.3.3.3 255.255.255.0 UG 0 0 0 eth0
    3.3.3.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    4.4.4.0 0.0.0.0 255.255.255.0 U 101 0 0 eth1
    =============================主机1==============================
    [root@ccc ~]# ping -c 2 4.4.4.4
    PING 4.4.4.4 (4.4.4.4) 56(84) bytes of data.
    64 bytes from 4.4.4.4: icmp_seq=1 ttl=62 time=1.77 ms
    64 bytes from 4.4.4.4: icmp_seq=2 ttl=62 time=0.972 ms
    --- 4.4.4.4 ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 1002ms
    rtt min/avg/max/mdev = 0.972/1.375/1.778/0.403 ms
  • 优化

    =============================主机1==============================
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    2.2.2.0 1.1.1.2 255.255.255.0 UG 0 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    3.3.3.0 1.1.1.2 255.255.255.0 UG 0 0 0 eth0
    4.4.4.0 1.1.1.2 255.255.255.0 UG 0 0 0 eth0
    [root@ccc ~]# route del -net 2.2.2.0/24 dev eth0
    [root@ccc ~]# route del -net 2.2.2.0/24 dev eth0
    [root@ccc ~]# route del -net 3.3.3.0/24 dev eth0
    [root@ccc ~]# route del -net 4.4.4.0/24 dev eth0
    [root@ccc ~]# route add default gw 1.1.1.2 dev eth0
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    0.0.0.0 1.1.1.2 0.0.0.0 UG 0 0 0 eth0
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    =============================主机2==============================
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 101 0 0 eth1
    3.3.3.0 2.2.2.3 255.255.255.0 UG 0 0 0 eth1
    3.3.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
    4.4.4.0 2.2.2.3 255.255.255.0 UG 0 0 0 eth1
    [root@ccc ~]# route del -net 3.3.3.0/24 dev eth1
    [root@ccc ~]# route del -net 3.3.3.0/24 dev eth1
    [root@ccc ~]# route del -net 4.4.4.0/24 dev eth1
    [root@ccc ~]# route add -net default gw 2.2.2.3 dev eth1
    [root@ccc ~]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    0.0.0.0 2.2.2.3 0.0.0.0 UG 0 0 0 eth1
    1.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
    2.2.2.0 0.0.0.0 255.255.255.0 U 101 0 0 eth1

正式班D26的更多相关文章

  1. 正式班D5

    2020.10.10星期六 正式班D5 一.上节课复习 1.硬盘分类 ​ 1.机械磁盘 ​ io时间=平均寻道时间+平均延迟时间 ​ buffer:写缓冲区 ​ cache:都缓存 ​ 2.固态硬盘 ...

  2. 正式班D7

    2020.10.13星期二 正式班D7 一.上节课复习 Linux发展 批处理系统 多道技术 分时操作系统 multics->Unix->minix->Linux(如Redhat.c ...

  3. 正式班D8

    2020.10.15星期四 正式班D8 一.上节课复习 OSI七层协议 socket socket是对传输层以下的封装 IP+port标识唯一一个基于网络通讯的软件 TCP与UDP TCP:因为在通信 ...

  4. 正式班D9

    2020.10.16星期五 正式班D9 一.vmware workstation的使用 虚拟机管理软件 定义 虚拟机(Virtual Machine)软件是一套特殊的软件,它可以作为操作系统独立运行, ...

  5. 正式班D11

    2020.10.20星期二 正式班D11 bash解释器交互式环境特性 命令和文件自动补全(Tab只能补全命令和文件) 快捷键 CTRL+C ==>终止前台运行的程序 CTRL+D ==> ...

  6. 正式班D12

    2020.10.21星期三 正式班D12 一.目录结构 系统目录结构 目录 文件夹:存放的是具体有哪些文件 文件:存放的就是具体的数据 需要记住的 /dev/cdrom # 光盘设备,光盘里存放的内容 ...

  7. 正式班D13

    2020.10.22星期四 正式班D13 修改文件内容 vim编辑 vim基础 可理解为Windows下的文本编辑器 vim可用来修改配置.写脚本 三种模式(命令模式.输入模式.末行模式) 命令模式按 ...

  8. 正式班D14

    2020.10.23星期五 正式班D14 9.5 文件处理三剑客(支持|) 9.5.1 sed流式编辑器 事先制定好编辑文件的指令,让sed自动完成对文件的整体编辑(同一时间内存中只有文件中一条) # ...

  9. 正式班D16

    2020.10.27星期二 正式班D16 目录 9.9 字符处理命令 9.9.1 sort排序 9.9.2 uniq去重 9.9.3 cut处理规律文本 9.9.4 tr替换 9.9.5 wc统计 9 ...

随机推荐

  1. js日志输出还是只会console.log么,那你就out了

    几乎所有的javascript开发者最常使用的日志打印调试api都是console.log(),其实还有很多的选项供我们选择,笔者下面就为大家一一介绍. 一.console.table() conso ...

  2. GC调优-XX:PrintGCDetails深度解析

    查看程序运行GC的运行情况 资源充足的GC情况 新生代 老年代 元空间 因为现在资源充足没有发生GC *案例:将JVM初始化内存与最大内存(防止内存抖动,反复GC)调至10m,new一个50m的数组对 ...

  3. “3D引擎和图形学技术点思路讲解”线上直播培训班报名开始啦(完全免费)

    大家好,我开了一个线上的直播课程培训班,完全免费,欢迎大家报名! 本课程重点教授"光线追踪"方面的实现思路. 我的相关经验 5年3D引擎开发经验 Wonder-WebGL 3D引擎 ...

  4. 多测师讲解接口测试_F12中network里headers各项属性的含义——高级讲师肖sir

    General部分: Request URL:资源的请求url # Request Method:HTTP方法  Status Code:响应状态码  200(状态码) OK 301 - 资源(网页等 ...

  5. 多测师讲解内置函数 _format_高级讲师肖sir

    #python中的格式化输出:format()# 和%号格式化输出一样,是%号的另外一种格式#1.不设置指定位置,按默认顺序 a ='{}'.format('hello','nihao','dajia ...

  6. 【idea&spring mvc】搭建简易的spring mvc项目(基于maven)!

    一.创建项目 1.打开idea,file--new--project 2.按照步骤①②③④操作 3.输入包名,并点击下一步 4.选择下载包的maven的setting.xml配置路径和包的存放地,然后 ...

  7. java 环境变量配置(win10)

    到官网下载jdk,链接https://www.oracle.com/technetwork/java/javase/downloads/index.html 安装好,进行环境变量配置,打开环境变量 1 ...

  8. pytest文档43-元数据使用(pytest-metadata)

    前言 什么是元数据?元数据是关于数据的描述,存储着关于数据的信息,为人们更方便地检索信息提供了帮助. pytest 框架里面的元数据可以使用 pytest-metadata 插件实现.文档地址http ...

  9. 为什么大部分的程序员学编程,都会选择从C语言开始?

    软件行业经过几十年的发展,编程语言的种类已经越来越多了,而且很多新的编程语言已经在这个领域从开始的默默无闻到如今风风火火,整个编程语言朝着集成化方向发展,这样会导致很多的初学者选择上不像以前那么单一了 ...

  10. LinkageSel无限级联动下拉菜单

    http://files.cnblogs.com/files/chenghu/LinkageSel-master.zip