# SRE0417_ - 準備虛擬機: - AR5401.zip - Windows XP.zip - UB5401.zip - [架構圖:](https://docs.google.com/presentation/d/1nxGU_LttsJqo_g1HEFDTW8pcF7GnBjPUJOtyMpqwFio/edit) ![p25](https://i.imgur.com/QwzRW5s.png) >--- ![p24](https://i.imgur.com/6ojjnex.png) --- - **左**架構機器準備: - AR23301 - Alpine 3.13.4 - M:2G/C:2C - AP23302 - Alpine 3.13.4 - M:2G/C:2C - AR23303 - Alpine 3.13.4 - M:2G/C:2C - King - Windows XP - M:4G/C:2C >--- - **右**架構機器準備: - AR23304 - Alpine 3.13.4 - M:2G/C:2C - AR23305 - Alpine 3.13.4 - M:2G/C:2C - US23301 - Ubuntu Server 20.04.2 - M:2G/C:2C - Queen - Windows XP - M:2G/C:2C --- ## **左**架構: ![](https://i.imgur.com/gk9nDXj.png) ### AR23301: - 加 route: $ sudo nano /etc/local.d/route_set.start ``` route add -net 10.233.0.64 netmask 255.255.255.192 gw 10.233.0.1 route add -net 10.233.0.128 netmask 255.255.255.192 gw 120.96.143.192 route add -net 10.233.0.192 netmask 255.255.255.192 gw 120.96.143.192 ``` - 給予執行權限,開啟開機執行檔功能 $ sudo chmod +x /etc/local.d/route_set.start $ sudo rc-update add local - ip 偽裝 $ iptables -t nat -A POSTROUTING -o eth0 ! -d 10.233.0.0/255.255.255.0 -j MASQUSEADE ### AP23301: - 加 route: $ sudo nano /etc/local.d/route_set.start ``` route add -net 10.233.0.64 netmask 255.255.255.192 gw 10.233.0.1 ``` > --- ## **右**架構: ![](https://i.imgur.com/4pW26rW.png) [AR6204] > $ route -n ``` Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 120.96.143.254 0.0.0.0 UG 1 0 0 eth0 10.0.62.0 120.96.143.62 255.255.255.192 UG 0 0 0 eth0 10.0.62.64 120.96.143.62 255.255.255.192 UG 0 0 0 eth0 10.0.62.128 0.0.0.0 255.255.255.192 U 0 0 0 eth1 10.0.62.192 10.0.62.129 255.255.255.192 UG 0 0 0 eth1 120.96.143.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 ``` > $ sudo nano /etc/local.d/route-set.start ```bash= #!/bin/bash sudo route add -net 10.0.62.192 netmask 255.255.255.192 gw 10.0.62.129 sudo route add -net 10.0.62.0 netmask 255.255.255.192 gw 120.96.143.62 sudo route add -net 10.0.62.64 netmask 255.255.255.192 gw 120.96.143.62 ``` > $ sudo nano /etc/network/interfaces ``` auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 120.96.143.212 netmask 255.255.255.0 gateway 120.96.143.254 hostname ar6204 auto eth1 iface eth1 inet static address 10.0.62.189 netmask 255.255.255.192 gateway4: 120.96.143.212 hostname ar6204 ``` > $ sudo nano /etc/sysctl.conf ``` net.ipv4.ip_forward = 1 ``` [UBD6201] > $ sudo nano /etc/rc.local ```bash= #!/bin/bash sudo route add -net 10.0.62.192 netmask 255.255.255.192 gw 10.0.62.129 sudo route add -net 10.0.62.0 netmask 255.255.255.192 gw 120.96.143.62 sudo route add -net 10.0.62.64 netmask 255.255.255.192 gw 10.0.62.2 sudo route add -net 120.96.143.0 netmask 255.255.255.0 gw 10.0.62.212 ``` > $ route -n ``` Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 120.96.143.254 0.0.0.0 UG 0 0 0 ens32 10.0.62.128 0.0.0.0 255.255.255.192 U 0 0 0 ens35 120.96.143.0 0.0.0.0 255.255.255.0 U 0 0 0 ens32 ``` > $ sudo nano /etc/netplan/00-installer-config.yaml ```yaml= # This is the network config written by 'subiquity' network: ethernets: ens32: addresses: - 120.96.143.162/24 gateway4: 120.96.143.254 ens35: addresses: - 10.0.62.190/26 version: 2 ``` [AR6205] > $ route -n ``` Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 10.0.62.189 0.0.0.0 UG 1 0 0 eth1 10.0.62.128 0.0.0.0 255.255.255.192 U 0 0 0 eth1 10.0.62.192 0.0.0.0 255.255.255.192 U 0 0 0 eth0 ``` > $ sudo nano /etc/network/interfaces ``` auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 10.0.62.254/26 hostname ar6205 auto eth1 iface eth1 inet static address 10.0.62.129/26 gateway 10.0.62.189 hostname ar6205 ``` > $ sudo nano /etc/sysctl.conf ``` net.ipv4.ip_forward = 1 ``` [Queen6201] ![](https://i.imgur.com/Z3CRRDn.png) ![](https://i.imgur.com/eB7XbCh.png) ![](https://i.imgur.com/TXtlVyM.png) ![](https://i.imgur.com/KiAEaBB.png) ![](https://i.imgur.com/v5p8gaN.png) ![](https://i.imgur.com/xkMGTgd.png)