| | 1 | [[PageOutline]] |
| | 2 | |
| | 3 | = VMによるネットワークテスト = |
| | 4 | == network map == |
| | 5 | {{{ |
| | 6 | WAN |
| | 7 | | |
| | 8 | | |
| | 9 | Windows (NAT) |
| | 10 | 192.168.40.1 |
| | 11 | | |
| | 12 | | |
| | 13 | ((( 192.168.40.0/24 ))) |
| | 14 | | | |
| | 15 | | | |
| | 16 | 192.168.40.10 192.168.40.20 |
| | 17 | | * |
| | 18 | <eth0> <eth0> |
| | 19 | [[ubuntu-outer]] <<centos-outer>> |
| | 20 | <eth1> <eth1> |
| | 21 | * | |
| | 22 | 10.0.0.10 10.0.0.20 |
| | 23 | | | |
| | 24 | | | |
| | 25 | (10.0.0.0/16) |
| | 26 | | |
| | 27 | | |
| | 28 | 10.0.0.254 |
| | 29 | *(10.0.0.20) |
| | 30 | <eth0> |
| | 31 | <<ubuntu-router>> |
| | 32 | <eth1> <eth2> |
| | 33 | | | |
| | 34 | 10.1.0.254 10.2.0.254 |
| | 35 | | | |
| | 36 | | | |
| | 37 | ((((( 10.1.0.0/16 ))))) ((((( 10.2.0.0/16 ))))) |
| | 38 | | | | | | | | | |
| | 39 | | | | | | | | | |
| | 40 | 10.1.0.10 10.1.0.20 | 10.1.0.30 10.2.0.30 | | | |
| | 41 | * | | | * / | | |
| | 42 | <eth0> <eth1> | <eth0> <eth1> / | | |
| | 43 | [[ubuntu-inner-AA]] | [[ubuntu-inner-AB]] / | | |
| | 44 | | / | | |
| | 45 | | / | | |
| | 46 | 10.1.0.110 10.2.0.110 10.2.0.10 10.2.0.20 |
| | 47 | | | * | |
| | 48 | <eth1> <eth2> <eth0> <eth1> |
| | 49 | [[centos-inner]] [[ubuntu-inner-BB]] |
| | 50 | <eth0> |
| | 51 | * |
| | 52 | 192.168.50.110 |
| | 53 | | |
| | 54 | | |
| | 55 | 192.168.50.1 |
| | 56 | Windows (NAT) |
| | 57 | | |
| | 58 | | |
| | 59 | WAN |
| | 60 | }}} |
| | 61 | * ((())) |
| | 62 | * LANセグメント |
| | 63 | * [[]] |
| | 64 | * 通常ノード |
| | 65 | * <<>> |
| | 66 | * net.ipv4.ip_forward=1 になっているノード |
| | 67 | * * が付いているNIC |
| | 68 | * デフォルトゲートウェイ |
| | 69 | |
| | 70 | == 設定 == |
| | 71 | === centos-outer === |
| | 72 | * centos-outer ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 |
| | 73 | {{{ |
| | 74 | DEVICE=eth0 |
| | 75 | BOOTPROTO=static |
| | 76 | IPADDR=192.168.40.20 |
| | 77 | NETMASK=255.255.255.0 |
| | 78 | NETWORK=192.168.40.0 |
| | 79 | GATEWAY=192.168.40.1 |
| | 80 | ONBOOT=yes |
| | 81 | }}} |
| | 82 | * centos-outer ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 |
| | 83 | {{{ |
| | 84 | DEVICE=eth1 |
| | 85 | BOOTPROTO=static |
| | 86 | IPADDR=10.0.0.20 |
| | 87 | NETMASK=255.255.0.0 |
| | 88 | NETWORK=10.0.0.0 |
| | 89 | ONBOOT=yes |
| | 90 | }}} |
| | 91 | * centos-outer ~]# route |
| | 92 | {{{ |
| | 93 | Kernel IP routing table |
| | 94 | Destination Gateway Genmask Flags Metric Ref Use Iface |
| | 95 | 192.168.40.0 * 255.255.255.0 U 0 0 0 eth0 |
| | 96 | 10.0.0.0 * 255.255.0.0 U 0 0 0 eth1 |
| | 97 | 169.254.0.0 * 255.255.0.0 U 0 0 0 eth1 |
| | 98 | default 192.168.40.1 0.0.0.0 UG 0 0 0 eth0 |
| | 99 | }}} |
| | 100 | * centos-outer ~]# ip route |
| | 101 | {{{ |
| | 102 | 192.168.40.0/24 dev eth0 proto kernel scope link src 192.168.40.20 |
| | 103 | 10.0.0.0/16 dev eth1 proto kernel scope link src 10.0.0.20 |
| | 104 | 169.254.0.0/16 dev eth1 scope link |
| | 105 | default via 192.168.40.1 dev eth0 |
| | 106 | }}} |
| | 107 | |
| | 108 | === ubuntu-outer === |
| | 109 | * ubuntu-outer:~$ cat /etc/network/interfaces |
| | 110 | {{{ |
| | 111 | auto lo |
| | 112 | iface lo inet loopback |
| | 113 | |
| | 114 | auto eth0 |
| | 115 | iface eth0 inet static |
| | 116 | address 192.168.40.10 |
| | 117 | netmask 255.255.255.0 |
| | 118 | network 192.168.40.0 |
| | 119 | |
| | 120 | auto eth1 |
| | 121 | iface eth1 inet static |
| | 122 | address 10.0.0.10 |
| | 123 | netmask 255.255.0.0 |
| | 124 | network 10.0.0.0 |
| | 125 | gateway 10.0.0.254 |
| | 126 | }}} |
| | 127 | * ubuntu-outer:~$ route |
| | 128 | {{{ |
| | 129 | Kernel IP routing table |
| | 130 | Destination Gateway Genmask Flags Metric Ref Use Iface |
| | 131 | 192.168.40.0 * 255.255.255.0 U 0 0 0 eth0 |
| | 132 | 10.0.0.0 * 255.255.0.0 U 0 0 0 eth1 |
| | 133 | default 10.0.0.254 0.0.0.0 UG 100 0 0 eth1 |
| | 134 | }}} |
| | 135 | * ubuntu-outer:~$ ip route |
| | 136 | {{{ |
| | 137 | 192.168.40.0/24 dev eth0 proto kernel scope link src 192.168.40.10 |
| | 138 | 10.0.0.0/16 dev eth1 proto kernel scope link src 10.0.0.10 |
| | 139 | default via 10.0.0.254 dev eth1 metric 100 |
| | 140 | }}} |
| | 141 | |
| | 142 | === ubuntu-router === |
| | 143 | * ubuntu-router:~$ cat /etc/network/interfaces |
| | 144 | {{{ |
| | 145 | auto lo |
| | 146 | iface lo inet loopback |
| | 147 | |
| | 148 | auto eth0 |
| | 149 | iface eth0 inet static |
| | 150 | address 10.0.0.254 |
| | 151 | netmask 255.255.0.0 |
| | 152 | network 10.0.0.0 |
| | 153 | gateway 10.0.0.20 |
| | 154 | |
| | 155 | auto eth1 |
| | 156 | iface eth1 inet static |
| | 157 | address 10.1.0.254 |
| | 158 | netmask 255.255.0.0 |
| | 159 | network 10.1.0.0 |
| | 160 | |
| | 161 | auto eth2 |
| | 162 | iface eth2 inet static |
| | 163 | address 10.2.0.254 |
| | 164 | netmask 255.255.0.0 |
| | 165 | network 10.2.0.0 |
| | 166 | }}} |
| | 167 | * ubuntu-router:~$ route |
| | 168 | {{{ |
| | 169 | Kernel IP routing table |
| | 170 | Destination Gateway Genmask Flags Metric Ref Use Iface |
| | 171 | 10.2.0.0 * 255.255.0.0 U 0 0 0 eth2 |
| | 172 | 10.0.0.0 * 255.255.0.0 U 0 0 0 eth0 |
| | 173 | 10.1.0.0 * 255.255.0.0 U 0 0 0 eth1 |
| | 174 | default 10.0.0.20 0.0.0.0 UG 100 0 0 eth0 |
| | 175 | }}} |
| | 176 | * ubuntu-router:~$ ip route |
| | 177 | {{{ |
| | 178 | 10.2.0.0/16 dev eth2 proto kernel scope link src 10.2.0.254 |
| | 179 | 10.0.0.0/16 dev eth0 proto kernel scope link src 10.0.0.254 |
| | 180 | 10.1.0.0/16 dev eth1 proto kernel scope link src 10.1.0.254 |
| | 181 | default via 10.0.0.20 dev eth0 metric 100 |
| | 182 | }}} |
| | 183 | |
| | 184 | === ubuntu-inner-AA === |
| | 185 | * ubuntu-inner-AA:~$ cat /etc/network/interfaces |
| | 186 | {{{ |
| | 187 | auto lo |
| | 188 | iface lo inet loopback |
| | 189 | |
| | 190 | auto eth0 |
| | 191 | iface eth0 inet static |
| | 192 | address 10.1.0.10 |
| | 193 | netmask 255.255.0.0 |
| | 194 | network 10.1.0.0 |
| | 195 | gateway 10.1.0.254 |
| | 196 | |
| | 197 | auto eth1 |
| | 198 | iface eth1 inet static |
| | 199 | address 10.1.0.20 |
| | 200 | netmask 255.255.0.0 |
| | 201 | network 10.1.0.0 |
| | 202 | }}} |
| | 203 | * ubuntu-inner-AA:~$ route |
| | 204 | {{{ |
| | 205 | Kernel IP routing table |
| | 206 | Destination Gateway Genmask Flags Metric Ref Use Iface |
| | 207 | 10.1.0.0 * 255.255.0.0 U 0 0 0 eth0 |
| | 208 | 10.1.0.0 * 255.255.0.0 U 0 0 0 eth1 |
| | 209 | default 10.1.0.254 0.0.0.0 UG 100 0 0 eth0 |
| | 210 | }}} |
| | 211 | * ubuntu-inner-AA:~$ ip route |
| | 212 | {{{ |
| | 213 | 10.1.0.0/16 dev eth0 proto kernel scope link src 10.1.0.10 |
| | 214 | 10.1.0.0/16 dev eth1 proto kernel scope link src 10.1.0.20 |
| | 215 | default via 10.1.0.254 dev eth0 metric 100 |
| | 216 | }}} |
| | 217 | |
| | 218 | === ubuntu-inner-AB === |
| | 219 | * ubuntu-inner-AB:~$ cat /etc/network/interfaces |
| | 220 | {{{auto lo |
| | 221 | iface lo inet loopback |
| | 222 | |
| | 223 | auto eth0 |
| | 224 | iface eth0 inet static |
| | 225 | address 10.1.0.30 |
| | 226 | netmask 255.255.0.0 |
| | 227 | network 10.1.0.0 |
| | 228 | |
| | 229 | auto eth1 |
| | 230 | iface eth1 inet static |
| | 231 | address 10.2.0.30 |
| | 232 | netmask 255.255.0.0 |
| | 233 | network 10.2.0.0 |
| | 234 | gateway 10.2.0.254 |
| | 235 | }}} |
| | 236 | * ubuntu-inner-AB:~$ route |
| | 237 | {{{ |
| | 238 | Kernel IP routing table |
| | 239 | Destination Gateway Genmask Flags Metric Ref Use Iface |
| | 240 | 10.2.0.0 * 255.255.0.0 U 0 0 0 eth1 |
| | 241 | 10.1.0.0 * 255.255.0.0 U 0 0 0 eth0 |
| | 242 | default 10.2.0.254 0.0.0.0 UG 100 0 0 eth1 |
| | 243 | }}} |
| | 244 | * ubuntu-inner-AB:~$ ip route |
| | 245 | {{{ |
| | 246 | 10.2.0.0/16 dev eth1 proto kernel scope link src 10.2.0.30 |
| | 247 | 10.1.0.0/16 dev eth0 proto kernel scope link src 10.1.0.30 |
| | 248 | default via 10.2.0.254 dev eth1 metric 100 |
| | 249 | }}} |
| | 250 | |
| | 251 | === ubuntu-inner-BB === |
| | 252 | * ubuntu-inner-BB:~$ cat /etc/network/interfaces |
| | 253 | {{{ |
| | 254 | auto lo |
| | 255 | iface lo inet loopback |
| | 256 | |
| | 257 | auto eth0 |
| | 258 | iface eth0 inet static |
| | 259 | address 10.2.0.10 |
| | 260 | netmask 255.255.0.0 |
| | 261 | network 10.2.0.0 |
| | 262 | gateway 10.2.0.254 |
| | 263 | |
| | 264 | auto eth1 |
| | 265 | iface eth1 inet static |
| | 266 | address 10.2.0.20 |
| | 267 | netmask 255.255.0.0 |
| | 268 | network 10.2.0.0 |
| | 269 | }}} |
| | 270 | * ubuntu-inner-BB:~$ route |
| | 271 | {{{ |
| | 272 | Kernel IP routing table |
| | 273 | Destination Gateway Genmask Flags Metric Ref Use Iface |
| | 274 | 10.2.0.0 * 255.255.0.0 U 0 0 0 eth0 |
| | 275 | 10.2.0.0 * 255.255.0.0 U 0 0 0 eth1 |
| | 276 | default 10.2.0.254 0.0.0.0 UG 100 0 0 eth0 |
| | 277 | }}} |
| | 278 | * ubuntu-inner-BB:~$ ip route |
| | 279 | {{{ |
| | 280 | 10.2.0.0/16 dev eth0 proto kernel scope link src 10.2.0.10 |
| | 281 | 10.2.0.0/16 dev eth1 proto kernel scope link src 10.2.0.20 |
| | 282 | default via 10.2.0.254 dev eth0 metric 100 |
| | 283 | }}} |
| | 284 | |
| | 285 | === centos-inner === |
| | 286 | * centos-inner ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 |
| | 287 | {{{ |
| | 288 | DEVICE=eth0 |
| | 289 | BOOTPROTO=static |
| | 290 | IPADDR=192.168.50.110 |
| | 291 | NETMASK=255.255.255.0 |
| | 292 | NETWORK=192.168.50.0 |
| | 293 | GATEWAY=192.168.50.1 |
| | 294 | ONBOOT=yes |
| | 295 | }}} |
| | 296 | * centos-inner ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 |
| | 297 | {{{ |
| | 298 | DEVICE=eth1 |
| | 299 | BOOTPROTO=static |
| | 300 | IPADDR=10.1.0.110 |
| | 301 | NETMASK=255.255.0.0 |
| | 302 | NETWORK=10.1.0.0 |
| | 303 | ONBOOT=yes |
| | 304 | }}} |
| | 305 | * centos-inner ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth2 |
| | 306 | {{{ |
| | 307 | DEVICE=eth2 |
| | 308 | BOOTPROTO=static |
| | 309 | IPADDR=10.2.0.110 |
| | 310 | NETMASK=255.255.0.0 |
| | 311 | NETWORK=10.2.0.0 |
| | 312 | ONBOOT=yes |
| | 313 | }}} |
| | 314 | * centos-inner ~]# route |
| | 315 | {{{ |
| | 316 | Kernel IP routing table |
| | 317 | Destination Gateway Genmask Flags Metric Ref Use Iface |
| | 318 | 192.168.50.0 * 255.255.255.0 U 0 0 0 eth0 |
| | 319 | 10.2.0.0 * 255.255.0.0 U 0 0 0 eth2 |
| | 320 | 10.1.0.0 * 255.255.0.0 U 0 0 0 eth1 |
| | 321 | 169.254.0.0 * 255.255.0.0 U 0 0 0 eth2 |
| | 322 | default 192.168.50.1 0.0.0.0 UG 0 0 0 eth0 |
| | 323 | }}} |
| | 324 | * centos-inner ~]# ip route |
| | 325 | {{{ |
| | 326 | 192.168.50.0/24 dev eth0 proto kernel scope link src 192.168.50.110 |
| | 327 | 10.2.0.0/16 dev eth2 proto kernel scope link src 10.2.0.110 |
| | 328 | 10.1.0.0/16 dev eth1 proto kernel scope link src 10.1.0.110 |
| | 329 | 169.254.0.0/16 dev eth2 scope link |
| | 330 | default via 192.168.50.1 dev eth0 |
| | 331 | }}} |