建设模板网站,合肥瑶海区天气,云主机是不是可以搭建无数个网站,哪个网站做五金冲压的一、网络架构
实验效果#xff0c;通过机器B的转发功能#xff0c;将机器A的报文转发到机器C 本实验准备三台机器分别配置如下网络 机器A ip:192.168.56.104 机器C ip:10.1.0.10 机器B 两张网卡#xff0c;分别的ip是192.168.56.106和10.1.0.11 如图所示
如下图所示
二、…一、网络架构
实验效果通过机器B的转发功能将机器A的报文转发到机器C 本实验准备三台机器分别配置如下网络 机器A ip:192.168.56.104 机器C ip:10.1.0.10 机器B 两张网卡分别的ip是192.168.56.106和10.1.0.11 如图所示
如下图所示
二、虚拟机网卡设置
设置两个host-Only的局域网 机器A的网络设置如下
机器B的网络设置如下 两个网卡分别连接两个局域网 机器C的网卡配置如下
三、虚拟机网络设置
A机器
B机器
连接局域网的实际上有两个网卡 enp0s8网卡设置如下
enp0s9网卡设置如下
C机器
配置好三台机器的网络以后 尝试A(192.168.56.104) ping B(192.168.56.106)
[rootlocalhost network-scripts]# ping 192.168.56.106
PING 192.168.56.106 (192.168.56.106) 56(84) bytes of data.
64 bytes from 192.168.56.106: icmp_seq1 ttl64 time1.12 ms
64 bytes from 192.168.56.106: icmp_seq2 ttl64 time0.861 msC(10.1.0.10) ping B(10.1.0.11)
[rootlocalhost ~]# ping 10.1.0.11
PING 10.1.0.11 (10.1.0.11) 56(84) bytes of data.
64 bytes from 10.1.0.11: icmp_seq1 ttl64 time0.933 ms
64 bytes from 10.1.0.11: icmp_seq2 ttl64 time0.899 ms可以发现 A和B ,C和B都是互通的 但是此时A和C不能互通 因此需要下面的步骤开启机器B的转发功能
四、开启作为路由机B的转发功能
/etc/sysctl.conf设置如下配置
[rootlocalhost ~]# cat /etc/sysctl.confnet.ipv4.ip_forward1 重启B机器
五、机器A和机器C的路由设置
通过手动添加路由规则将A与机器C10.1.0.10的报文都通过网关B进行处理 机器A192.168.56.104 注意route 设置只在当前运行时有效重启后就没有该路由规则了
[rootlocalhost network-scripts]# route add -net 10.1.0.0/16 gw 192.168.56.106
[rootlocalhost network-scripts]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.56.100 0.0.0.0 UG 100 0 0 enp0s8
10.1.0.0 192.168.56.106 255.255.0.0 UG 0 0 0 enp0s8
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.56.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s8
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0同样的机器C10.1.0.10想连机器A192.168.56.104也得设置一下路由
[rootlocalhost network-scripts]# route add -net 192.168.56.0/24 gw 10.1.0.11
[rootlocalhost ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.1.0.2 0.0.0.0 UG 100 0 0 enp0s8
10.1.0.0 0.0.0.0 255.255.0.0 U 100 0 0 enp0s8
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.56.0 10.1.0.11 255.255.255.0 UG 0 0 0 enp0s8
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0机器A192.168.56.104ping 机器C10.1.0.10
[rootlocalhost network-scripts]# ping 10.1.0.10
PING 10.1.0.10 (10.1.0.10) 56(84) bytes of data.
64 bytes from 10.1.0.10: icmp_seq1 ttl63 time1.51 ms
64 bytes from 10.1.0.10: icmp_seq2 ttl63 time1.61 ms机器C10.1.0.10ping机器A192.168.56.104
[rootlocalhost ~]# ping 192.168.56.104
PING 192.168.56.104 (192.168.56.104) 56(84) bytes of data.
64 bytes from 192.168.56.104: icmp_seq1 ttl63 time1.62 ms
64 bytes from 192.168.56.104: icmp_seq2 ttl63 time1.75 ms现在A和C机器就可以互通了