次のような、3つのネットワークを2台のルータで接続したネットワークを作 ります。
ネットワークアドレスは 172.16.0.0/16 を受け取り、 外部Webサーバは http://172.17.0.10/ とします。
AT-AR2050V で、レイヤ3スイッチとして使えるのは LAN 側のポートなので、 LAN側のみを使用する。 LAN1,2 は端末などを接続するポートとし、 LAN3 は AT-AR2050V同士を結ぶ バックボーンとする。 LAN4 は対外線接続ポートとする(router1のみ)。
no spanning-tree rstp enable
hostname router1
vlan database
vlan 3,4,11,12
exit
interface vlan3
ip address 172.16.3.1/24
exit
interface vlan4
ip address 172.16.0.1/24
exit
interface vlan11
ip address 172.16.11.1/24
exit
interface vlan12
ip address 172.16.12.1/24
exit
interface port1.0.1
switchport mode access
switchport access vlan 11
exit
interface port1.0.2
switchport mode access
switchport access vlan 12
exit
interface port1.0.3
switchport mode access
switchport access vlan 3
exit
interface port1.0.4
switchport mode access
switchport access vlan 4
end
no spanning-tree rstp enable
hostname router2
vlan database
vlan 3,21,22
exit
interface vlan3
ip address 172.16.3.2/24
exit
interface vlan21
ip address 172.16.21.1/24
exit
interface vlan22
ip address 172.16.22.1/24
exit
interface port1.0.1
switchport mode access
switchport access vlan 21
exit
interface port1.0.2
switchport mode access
switchport access vlan 22
exit
interface port1.0.3
switchport mode access
switchport access vlan 3
end
ip route 0.0.0.0/0 172.16.0.254
ip route 172.16.21.0/24 172.16.3.2
ip route 172.16.22.0/24 172.16.3.2
end
ip route 0.0.0.0/0 172.16.3.1
ip route 172.16.11.0/24 172.16.3.1
ip route 172.16.12.0/24 172.16.3.1
end
入力したスタティックルートのうち、デフォルト以外がある場合は
router rip
network 172.16.0.0/16
redistribute static
end
入力したスタティックルートを
no ip route 0.0.0.0/0
no ip route 172.16.11.0/24
no ip route 172.16.12.0/24
router rip
network 172.16.0.0/16
end
入力したスタティックルートのうち、デフォルト以外がある場合は
no ip route 172.16.21.0/24
no ip route 172.16.22.0/24
router ospf
network 172.16.0.0/16 area 0
default-information originate
redistribute static
end
no ip route 0.0.0.0/0
no ip route 172.16.11.0/24
no ip route 172.16.12.0/24
router ospf
network 172.16.0.0/16 area 0
end
service dhcp-server
ip dhcp pool pool11
network 172.16.11.0/24
range 172.16.11.65 172.16.11.126
default-router 172.16.11.1
exit
ip dhcp pool pool12
network 172.16.12.0/24
range 172.16.12.65 172.16.12.126
default-router 172.16.12.1
end
service dhcp-server
ip dhcp pool pool21
network 172.16.21.0/24
range 172.16.21.65 172.16.21.126
default-router 172.16.21.1
exit
ip dhcp pool pool22
network 172.16.22.0/24
range 172.16.22.65 172.16.22.126
default-router 172.16.22.1
end
router1 の LAN1 をNAPTでファイアーウォールで保護し、クラスCのネットワー クとして再定義する。 これは、市販のブロードバンドルータとほぼ同じ設定となる。
172.16.11.0/24 のネットワークを消すので、
router2 での経路定義は不要となる。
vlan database
vlan 111
exit
interface vlan111
ip address 192.168.1.1/24
exit
interface port1.0.1
switchport access vlan 111
exit
zone private
network private1
ip subnet 192.168.1.0/24
exit
exit
zone public
network public1
ip subnet 0.0.0.0/0 interface vlan4
ip subnet 172.16.0.0/16 interface vlan12
ip subnet 172.16.0.0/16 interface vlan3
exit
exit
firewall
rule 10 permit any from private to private
rule 20 permit any from private to public
rule 30 permit any from public to public
protect
exit
nat
rule 10 masq any from private to public
enable
exit
service dhcp-server
ip dhcp pool pool111
network 192.168.1.0/24
range 192.168.1.65 192.168.1.126
default-router 192.168.1.1
end
router2 の LAN1 をNAPTでファイアーウォールで保護し、クラスCのネットワー クとして再定義する。 これは、市販のブロードバンドルータとほぼ同じ設定となる。
172.16.21.0/24 のネットワークを消すので、
router1 での経路定義は不要となる。
vlan database
vlan 121
exit
interface vlan121
ip address 192.168.1.1/24
exit
interface port1.0.1
switchport access vlan 121
exit
zone private
network private1
ip subnet 192.168.1.0/24
exit
exit
zone public
network public1
ip subnet 0.0.0.0/0 interface vlan3
ip subnet 172.16.0.0/16 interface vlan22
exit
exit
firewall
rule 10 permit any from private to private
rule 20 permit any from private to public
rule 30 permit any from public to public
protect
exit
nat
rule 10 masq any from private to public
enable
exit
service dhcp-server
ip dhcp pool pool121
network 192.168.1.0/24
range 192.168.1.65 192.168.1.126
default-router 192.168.1.1
end
no spanning-tree rstp enable
hostname router1
vlan database
vlan 4,11,12
exit
interface vlan4
ip address 172.16.0.1/24
exit
interface vlan11
ip address 172.16.11.1/24
exit
interface vlan12
ip address 172.16.12.1/24
exit
interface port1.0.1
switchport mode access
switchport access vlan 11
exit
interface port1.0.2
switchport mode access
switchport access vlan 12
exit
interface port1.0.3
switchport mode trunc
switchport trunc allowed vlan all
exit
interface port1.0.4
switchport mode access
switchport access vlan 4
exit
ip route 0.0.0.0/0 172.16.0.254
service dhcp-server
ip dhcp pool pool11
network 172.16.11.0/24
range 172.16.11.65 172.16.11.126
default-router 172.16.11.1
exit
ip dhcp pool pool12
network 172.16.12.0/24
range 172.16.12.65 172.16.12.126
default-router 172.16.12.1
end
no spanning-tree rstp enable
hostname router2
vlan database
vlan 11,12
exit
interface port1.0.1
switchport mode access
switchport access vlan 11
exit
interface port1.0.2
switchport mode access
switchport access vlan 12
exit
interface port1.0.3
switchport mode trunk
switchport trunk allowed vlan all
end
hostname router1
ip routing
vlan 11
exit
vlan 12
exit
vlan 3
exit
vlan 4
exit
interface Vlan11
ip address 172.16.11.1 255.255.255.0
no shutdown
exit
interface Vlan12
ip address 172.16.12.1 255.255.255.0
no shutdown
exit
interface Vlan3
ip address 172.16.3.1 255.255.255.0
no shutdown
exit
interface Vlan4
ip address 172.16.0.1 255.255.255.0
no shutdown
exit
interface FastEthernet0/1
switchport access vlan 11
switchport mode access
no shutdown
exit
interface FastEthernet0/2
switchport access vlan 12
switchport mode access
no shutdown
exit
interface FastEthernet0/3
switchport access vlan 3
switchport mode access
no shutdown
exit
interface FastEthernet0/4
switchport access vlan 4
switchport mode access
no shutdown
end
hostname router2
ip routing
vlan 21
exit
vlan 22
exit
vlan 3
exit
interface Vlan21
ip address 172.16.21.1 255.255.255.0
no shutdown
exit
interface Vlan22
ip address 172.16.22.1 255.255.255.0
no shutdown
exit
interface Vlan3
ip address 172.16.3.2 255.255.255.0
no shutdown
exit
interface FastEthernet0/1
switchport access vlan 21
switchport mode access
no shutdown
exit
interface FastEthernet0/2
switchport access vlan 22
switchport mode access
no shutdown
exit
interface FastEthernet0/3
switchport access vlan 3
switchport mode access
no shutdown
end
ip route 0.0.0.0 0.0.0.0 172.16.0.254
ip route 172.16.21.0 255.255.255.0 172.16.3.2
ip route 172.16.22.0 255.255.255.0 172.16.3.2
end
ip route 0.0.0.0 0.0.0.0 172.16.3.1
ip route 172.16.11.0 255.255.255.0 172.16.3.1
ip route 172.16.12.0 255.255.255.0 172.16.3.1
end
no ip route 172.16.21.0 255.255.255.0
no ip route 172.16.22.0 255.255.255.0
router rip
version 2
network 172.16.0.0
default-information originate
end
no ip route 172.16.11.0 255.255.255.0
no ip route 172.16.12.0 255.255.255.0
router rip
version 2
network 172.16.0.0
end
router ospf 109
network 172.16.0.0 255.255.0.0 area 0
!default-information originate
end
service dhcp
ip dhcp pool PC11
network 172.16.11.0 255.255.255.0
default-router 172.16.11.1
exit
ip dhcp pool PC12
network 172.16.12.0 255.255.255.0
default-router 172.16.12.1
end
service dhcp
ip dhcp pool PC21
network 172.16.21.0 255.255.255.0
default-router 172.16.21.1
exit
ip dhcp pool PC22
network 172.16.22.0 255.255.255.0
default-router 172.16.22.1
end
ip routing
vlan 11
exit
vlan 12
exit
vlan 4
exit
interface Vlan11
ip address 172.16.11.1 255.255.255.0
no shutdown
exit
interface Vlan12
ip address 172.16.12.1 255.255.255.0
no shutdown
exit
interface Vlan4
ip address 172.16.0.1 255.255.255.0
no shutdown
exit
interface FastEthernet0/1
switchport access vlan 11
switchport mode access
no shutdown
exit
interface FastEthernet0/2
switchport access vlan 12
switchport mode access
no shutdown
exit
interface FastEthernet0/3
switchport trunk encapsulation dot1q
switchport mode trunk
no shutdown
exit
interface FastEthernet0/4
switchport access vlan 4
switchport mode access
no shutdown
exit
ip route 0.0.0.0 0.0.0.0 172.16.0.254
service dhcp
ip dhcp pool pool11
network 172.16.11.0 255.255.255.0
default-router 172.16.11.1
exit
ip dhcp pool pool12
network 172.16.12.0 255.255.255.0
default-router 172.16.12.1
end
ip routing
vlan 11
exit
vlan 12
exit
interface FastEthernet0/1
switchport access vlan 11
switchport mode access
no shutdown
exit
interface FastEthernet0/2
switchport access vlan 12
switchport mode access
no shutdown
exit
interface FastEthernet0/3
switchport mode trunk
switchport trunk allowed vlan all
no shutdown
end
set system mode router
configure terminal
no cdp run
no bonjour enable
no bonjour interface range vlan 1
vlan database
vlan 16-23
exit
interface vlan 1
no ip address dhcp
exit
ip dhcp server
interface vlan 16
ip address 172.16.0.254 255.255.255.0
exit
ip dhcp pool host raspi0
address 172.16.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.16.0.254
exit
interface fa1
switchport mode access
switchport access vlan 16
exit
ip route 172.16.0.0 255.255.0.0 172.16.0.1
interface vlan 17
ip address 172.17.0.254 255.255.255.0
exit
ip dhcp pool host raspi1
address 172.17.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.17.0.254
exit
interface fa2
switchport mode access
switchport access vlan 17
exit
ip route 172.17.0.0 255.255.0.0 172.17.0.1
interface vlan 18
ip address 172.18.0.254 255.255.255.0
exit
ip dhcp pool host raspi2
address 172.18.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.18.0.254
exit
interface fa3
switchport mode access
switchport access vlan 18
exit
ip route 172.18.0.0 255.255.0.0 172.18.0.1
interface vlan 19
ip address 172.19.0.254 255.255.255.0
exit
ip dhcp pool host raspi3
address 172.19.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.19.0.254
exit
interface fa4
switchport mode access
switchport access vlan 19
exit
ip route 172.19.0.0 255.255.0.0 172.19.0.1
interface vlan 20
ip address 172.20.0.254 255.255.255.0
exit
ip dhcp pool host raspi4
address 172.20.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.20.0.254
exit
interface fa5
switchport mode access
switchport access vlan 20
exit
ip route 172.20.0.0 255.255.0.0 172.20.0.1
interface vlan 21
ip address 172.21.0.254 255.255.255.0
exit
ip dhcp pool host raspi5
address 172.21.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.21.0.254
exit
interface fa6
switchport mode access
switchport access vlan 21
exit
ip route 172.21.0.0 255.255.0.0 172.21.0.1
interface vlan 22
ip address 172.22.0.254 255.255.255.0
exit
ip dhcp pool host raspi6
address 172.22.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.22.0.254
exit
interface fa7
switchport mode access
switchport access vlan 22
exit
ip route 172.22.0.0 255.255.0.0 172.22.0.1
interface vlan 23
ip address 172.23.0.254 255.255.255.0
exit
ip dhcp pool host raspi7
address 172.23.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.23.0.254
exit
interface fa8
switchport mode access
switchport access vlan 23
exit
ip route 172.23.0.0 255.255.0.0 172.23.0.1
end
set system mode router
configure terminal
no cdp run
no bonjour enable
no bonjour interface range vlan 1
vlan database
vlan 16-23
exit
interface vlan 1
no ip address dhcp
exit
ip dhcp server
interface vlan 16
ip address 172.16.0.254 255.255.255.0
exit
ip dhcp pool host raspi0
address 172.16.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.16.0.254
exit
ip dhcp pool host raspi20
address 172.16.0.11 255.255.255.0 hardware-address b8:27:eb:7a:5e:6f
default-router 172.16.0.254
exit
interface ge1
switchport mode access
switchport access vlan 16
exit
ip route 172.16.0.0 255.255.0.0 172.16.0.1
interface vlan 17
ip address 172.17.0.254 255.255.255.0
exit
ip dhcp pool host raspi1
address 172.17.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.17.0.254
exit
ip dhcp pool host raspi21
address 172.17.0.11 255.255.255.0 hardware-address b8:27:eb:7a:5e:6f
default-router 172.17.0.254
exit
interface ge2
switchport mode access
switchport access vlan 17
exit
ip route 172.17.0.0 255.255.0.0 172.17.0.1
interface vlan 18
ip address 172.18.0.254 255.255.255.0
exit
ip dhcp pool host raspi2
address 172.18.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.18.0.254
exit
ip dhcp pool host raspi22
address 172.18.0.11 255.255.255.0 hardware-address b8:27:eb:7a:5e:6f
default-router 172.18.0.254
exit
interface ge3
switchport mode access
switchport access vlan 18
exit
ip route 172.18.0.0 255.255.0.0 172.18.0.1
interface vlan 19
ip address 172.19.0.254 255.255.255.0
exit
ip dhcp pool host raspi3
address 172.19.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.19.0.254
exit
ip dhcp pool host raspi23
address 172.19.0.11 255.255.255.0 hardware-address b8:27:eb:7a:5e:6f
default-router 172.19.0.254
exit
interface ge4
switchport mode access
switchport access vlan 19
exit
ip route 172.19.0.0 255.255.0.0 172.19.0.1
interface vlan 20
ip address 172.20.0.254 255.255.255.0
exit
ip dhcp pool host raspi4
address 172.20.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.20.0.254
exit
ip dhcp pool host raspi24
address 172.20.0.11 255.255.255.0 hardware-address b8:27:eb:7a:5e:6f
default-router 172.20.0.254
exit
interface ge5
switchport mode access
switchport access vlan 20
exit
ip route 172.20.0.0 255.255.0.0 172.20.0.1
interface vlan 21
ip address 172.21.0.254 255.255.255.0
exit
ip dhcp pool host raspi5
address 172.21.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.21.0.254
exit
ip dhcp pool host raspi25
address 172.21.0.11 255.255.255.0 hardware-address b8:27:eb:7a:5e:6f
default-router 172.21.0.254
exit
interface ge6
switchport mode access
switchport access vlan 21
exit
ip route 172.21.0.0 255.255.0.0 172.21.0.1
interface vlan 22
ip address 172.22.0.254 255.255.255.0
exit
ip dhcp pool host raspi6
address 172.22.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.22.0.254
exit
ip dhcp pool host raspi26
address 172.22.0.11 255.255.255.0 hardware-address b8:27:eb:7a:5e:6f
default-router 172.22.0.254
exit
interface ge7
switchport mode access
switchport access vlan 22
exit
ip route 172.22.0.0 255.255.0.0 172.22.0.1
interface vlan 23
ip address 172.23.0.254 255.255.255.0
exit
ip dhcp pool host raspi7
address 172.23.0.10 255.255.255.0 hardware-address b8:27:eb:dc:3d:bb
default-router 172.23.0.254
exit
ip dhcp pool host raspi27
address 172.23.0.11 255.255.255.0 hardware-address b8:27:eb:7a:5e:6f
default-router 172.23.0.254
exit
interface ge8
switchport mode access
switchport access vlan 23
exit
ip route 172.23.0.0 255.255.0.0 172.23.0.1
end
OS は Raspbian jessie を採用。
#! /bin/sh rsync -auvzb -e ssh --exclude='*~' --keep-dirlinks p5.net.c.dendai.ac.jp:doc/dendai/lab/red ~/doc/dendai/lab/ rsync -auvzb -e ssh --exclude='*~' --copy-links p5.net.c.dendai.ac.jp:edu/WWW ~/edu/ rsync -auvzb -e ssh --exclude='*~' p5.net.c.dendai.ac.jp:doc/dendai/lab/www ~/doc/dendai/lab/ rsync -auvzb -e ssh --exclude='*~' p5.net.c.dendai.ac.jp:doc/dendai/lab/home ~/doc/dendai/lab/
#! /bin/sh rsync -auvzb -e ssh --exclude='*~' --copy-links ~/doc/dendai/lab/red p5.net.c.dendai.ac.jp:doc/dendai/lab/
namedconf.options で auth-nxdomain no; を設定する。
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
zone "net.c.dendai.ac.jp" {
type master;
file "/etc/bind/local/db.net";
};
zone "30.172.in-addr.arpa" {
type master;
file "/etc/bind/local/db.172.30";
};
zone "10.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "16.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "17.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "18.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "19.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "20.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "21.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "22.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "23.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "24.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "25.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "26.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "27.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "28.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "29.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "31.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
zone "168.192.in-addr.arpa" { type master; file "/etc/bind/db.empty"; };
;
; Zone file for linux.bogus
;
; The full zone file
;
$TTL 3D
@ IN SOA red.net.c.dendai.ac.jp. hostmaster.red.net.c.dendai.ac.jp. (
201606121 ; serial, todays date + todays serial #
8H ; refresh, seconds
2H ; retry, seconds
4W ; expire, seconds
1D ) ; minimum, seconds
;
NS red.net.c.dendai.ac.jp.
;
localhost A 127.0.0.1
red A 172.30.12.1
edu cname red
www cname red
$TTL 3D
@ IN SOA red.net.c.dendai.ac.jp. hostmaster.red.net.c.dendai.ac.jp. (
201606121 ; serial, todays date + todays serial #
8H ; refresh, seconds
2H ; retry, seconds
4W ; expire, seconds
1D ) ; minimum, seconds
;
NS red.net.c.dendai.ac.jp.
;
1.12 PTR red.net.c.dendai.ac.jp.
本サーバと同一