zoukankan      html  css  js  c++  java
  • ubuntu下的路由实验

    这个实验先演示两个client是如何通过路由器进行通信的。

    我们至少需要三个虚拟机:clientA、clientB和route。


    对clientA的网卡进行设置:

    #the primary network interface

    auto ens33

    iface ens33 inet static

    address 55.55.55.58

    gateway 55.55.55.55

    netmask 255.0.0.0


    对clientB的网卡进行设置:

    #the primary network interface

    auto ens33

    iface ens33 inet static

    address 166.66.66.67

    gateway 166.66.66.66

    netmask 255.255.0.0


    对route进行设置:

    #The first network interface

    auto ens33

    iface ens33 inet static

    address 55.55.55.55

    netmask 255.0.0.0

    #The second network interface

    auto ens38

    iface ens38 inet static

    address 166.66.66.66

    netmask 255.255.0.0 


    进行如上配置后,结果如下:

    client1:

    client2:

    route:

    网络状态如下:

    注意:路由器的转发功能默认是不开启的,利用“sudo sysctl -w net.ipv4.ip_forward=1”打开,否则不能转发报文。

    测试:用clientA去ping clientB,可以ping的通,用clientB去ping clientA也可以ping的通。

  • 相关阅读:
    Python Challenge 第十二关
    Python Challenge 第十一关
    Python Challenge 第十关
    Python Challenge 第九关
    Python Challenge 第八关
    Python Challenge 第七关
    zepto
    zepto
    zepto
    zepto
  • 原文地址:https://www.cnblogs.com/zhazhalovecoding/p/5966229.html
Copyright © 2011-2022 走看看