EdgeRouter XでDS-Lite+公開サーバ用PPPoE設定 その3

今回は、IPoE+DS-Lite+PPPoEの私の設定内容を公開しようと思います。
ネットワーク環境は、WAN側光電話なし、東NTT光をeth0に接続してます。LAN1は、公開サーバ用のネットワーク192.168.10.0/24です。こちらはPPoEのパケットを流し込みします。LAN2は、ネットサーフィン用のネットワーク192.168.1.0/24です。こちらにDS-Lite接続のパケットを流し込みます。

1.FireWallの設定

 firewall {
     all-ping enable
     broadcast-ping disable
     ipv6-name WANv6_IN {
         default-action drop
         description "WANv6 to LAN"
         enable-default-log
         rule 10 {
             action accept
             description "Allow established/related"
             state {
                 established enable
                 related enable
             }
         }
         rule 20 {
             action accept
             description "Allow IPv6 ICMP"
             protocol ipv6-icmp
         }
         rule 30 {
             action drop
             description "Drop invalid state"
             state {
                 invalid enable
             }
         }
     }
     ipv6-name WANv6_LOCAL {
         default-action drop
         description "WANv6 to Router"
         enable-default-log
         rule 10 {
             action accept
             description "Allow established/related"
             state {
                 established enable
                 related enable
             }
         }
         rule 20 {
             action accept
             description "Allow IPv6 ICMP"
             protocol ipv6-icmp
         }
         rule 30 {
             action drop
             description "Drop invalid state"
             state {
                 invalid enable
             }
         }
     }
     ipv6-receive-redirects disable
     ipv6-src-route disable
     ip-src-route disable
     log-martians enable
     modify LAN_PBR {
         rule 10 {
             action modify
             description "LAN to PPPoE"
             destination {
                 address !192.168.0.0/16
             }
             modify {
                 table 1
             }
             source {
                 address 192.168.10.0/24
             }
         }
         rule 20 {
             action modify
             description "LAN to DSLite"
             destination {
                 address !192.168.0.0/16
             }
             modify {
                 table 2
             }
             source {
                 address 192.168.1.0/24
             }
         }
     }
     name DSLite_IN {
         default-action drop
         description "DSLite to LAN"
         rule 10 {
             action accept
             description "Allow established/related"
             state {
                 established enable
                 related enable
             }
         }
         rule 20 {
             action drop
             description "Drop invalid state"
             state {
                 invalid enable
             }
         }
     }
     name DSLite_LOCAL {
         default-action drop
         description "DSLite to Router"
         rule 10 {
             action accept
             description "Allow established/related"
             state {
                 established enable
                 related enable
             }
         }
         rule 40 {
             action drop
             description "Drop invalid state"
             state {
                 invalid enable
             }
         }
     }
     name PPPoE_IN {
         default-action drop
         description "PPPoE to LAN"
         rule 10 {
             action accept
             description "Allow established/related"
             state {
                 established enable
                 related enable
             }
         }
         rule 20 {
             action drop
             description "Drop invalid state"
             state {
                 invalid enable
             }
         }
     }
     name PPPoE_LOCAL {
         default-action drop
         description "PPPoE to Router"
         rule 10 {
             action accept
             description "Allow established/related"
             state {
                 established enable
                 related enable
             }
         }
         rule 20 {
             action accept
             description "Allow IKE, L2TP, NAT-T"
             destination {
                 port 500,1701,4500
             }
             protocol udp
         }
         rule 30 {
             action accept
             description "Allow ESP"
             protocol esp
         }
         rule 40 {
             action drop
             description "Drop invalid state"
             state {
                 invalid enable
             }
         }
     }
     options {
         mss-clamp {
             interface-type pppoe
             mss 1414
         }
     }
     receive-redirects disable
     send-redirects enable
     source-validation disable
     syn-cookies enable
 }
modify LAN_PBRがDS-LiteとPPPoEを両方を切り分けのポイントです。あと、PPPoE_LOCALのrule20,30はGoogle Cloud Platformとvpn接続のためのものです。VPN IPsec利用しないときは不要です。

2.Interfacesの設定

 interfaces {
     ethernet eth0 {
         description WAN(IPoE+DS-Lite+PPPoE)
         duplex auto
         firewall {
             in {
                 ipv6-name WANv6_IN
             }
             local {
                 ipv6-name WANv6_LOCAL
             }
         }
         ipv6 {
             address {
                 autoconf
             }
             disable-forwarding
             dup-addr-detect-transmits 1
         }
         pppoe 0 {
             default-route auto
             firewall {
                 in {
                     name PPPoE_IN
                 }
                 local {
                     name PPPoE_LOCAL
                 }
             }
             mtu 1454
             name-server auto
             password xxxx
             user-id xxx@xxxxxx
         }
         speed auto
     }
     ethernet eth1 {
         address 192.168.10.1/24
         description LAN1
         duplex auto
         firewall {
             in {
                 modify LAN_PBR
             }
         }
         speed auto
     }
     ethernet eth2 {
         description LAN2
         duplex auto
         speed auto
     }
     ethernet eth3 {
         description LAN2
         duplex auto
         speed auto
     }
     ethernet eth4 {
         description LAN2
         duplex auto
         speed auto
     }
     ipv6-tunnel v6tun0 {
         description DSLite
         encapsulation ipip6
         firewall {
             in {
                 name DSLite_IN
             }
             local {
                 name DSLite_LOCAL
             }
         }
         local-ip 2409:xx:xx:xx:xx:xx:xx:xx
         multicast disable
         remote-ip 2404:8e00::feed:100
         ttl 64
     }
     loopback lo {
     }
     switch switch0 {
         address 192.168.1.1/24
         description LAN2
         firewall {
             in {
                 modify LAN_PBR
             }
         }
         mtu 1500
         switch-port {
             interface eth2 {
             }
             interface eth3 {
             }
             interface eth4 {
             }
             vlan-aware disable
         }
     }
 }
pppoeとipv6-tunnelの設定はそれぞれの環境に合わせてください。eth1とswitchにfirewallで設定したmodify LAN_PBRを設定します。

3.Port-forwardの設定

 port-forward {
     auto-firewall enable
     hairpin-nat enable
     lan-interface eth1
     rule 1 {
         description http
         forward-to {
             address 192.168.10.202
             port 80
         }
         original-port 80
         protocol tcp
     }
     rule 2 {
         description https
         forward-to {
             address 192.168.10.202
             port 443
         }
         original-port 443
         protocol tcp
     }
     wan-interface pppoe0
 }

WANからのhttpとhttpsは、公開サーバに転送。

4.Protocolsの設定

 protocols {
     static {
         interface-route 0.0.0.0/0 {
             next-hop-interface pppoe0 {
                 distance 200
             }
             next-hop-interface v6tun0 {
             }
         }
         table 1 {
             interface-route 0.0.0.0/0 {
                 next-hop-interface pppoe0 {
                 }
             }
         }
         table 2 {
             interface-route 0.0.0.0/0 {
                 next-hop-interface v6tun0 {
                 }
             }
         }
     }
 }
table1,2を追加して行き先をpppoe0かv6tun0を設定しています。

5.Serviceの設定

 service {
     dhcp-server {
         disabled false
         hostfile-update disable
         shared-network-name LAN1 {
             authoritative enable
             subnet 192.168.10.0/24 {
                 default-router 192.168.10.1
                 dns-server 192.168.10.1
                 lease 86400
                 start 192.168.10.38 {
                     stop 192.168.10.199
                 }
                 static-mapping 10 {
                     ip-address 192.168.10.201
                     mac-address xx:xx:xx:xx:xx:xx
                 }
                 static-mapping 11 {
                     ip-address 192.168.10.202
                     mac-address xx:xx:xx:xx:xx:xx
                 }
             }
         }
         shared-network-name LAN2 {
             authoritative enable
             subnet 192.168.1.0/24 {
                 default-router 192.168.1.1
                 dns-server 192.168.1.1
                 lease 86400
                 start 192.168.1.38 {
                     stop 192.168.1.199
                 }
                 static-mapping 20 {
                     ip-address 192.168.1.201
                     mac-address xx:xx:xx:xx:xx:xx
                 }
                 static-mapping 21 {
                     ip-address 192.168.1.202
                     mac-address xx:xx:xx:xx:xx:xx
                 }
                 static-mapping 22 {
                     ip-address 192.168.1.203
                     mac-address xx:xx:xx:xx:xx:xx
                 }
             }
         }
         use-dnsmasq disable
     }
     dns {
         dynamic {
             interface pppoe0 {
                 service custom-duckdns {
                     host-name xxxx.duckdns.org
                     login nouser
                     password xxxx-xxxx-xxxx-xxxx-xxxx
                     protocol dyndns2
                     server www.duckdns.org
                 }
             }
         }
         forwarding {
             cache-size 150
             listen-on eth1
             listen-on switch0
             system
         }
     }
     gui {
         http-port 80
         https-port 443
         older-ciphers enable
     }
     nat {
         rule 5010 {
             description "masquerade for PPPoE"
             outbound-interface pppoe0
             type masquerade
         }
     }
     ssh {
         port 22
         protocol-version v2
     }
 }
dnsは、duckdnsの例です。PPPoEのIPを利用しています。

6.Systemの設定

 port-forward {
 system {
     host-name xxxx
     login {
         user xxxxxx {
             authentication {
                 encrypted-password xxxxxxxxxxxxxxxxxxxxxxx
             }
             level admin
         }
     }
     name-server 2001:4860:4860::8888
     name-server 2001:4860:4860::8844
     ntp {
         server 0.ubnt.pool.ntp.org {
         }
         server 1.ubnt.pool.ntp.org {
         }
         server 2.ubnt.pool.ntp.org {
         }
         server 3.ubnt.pool.ntp.org {
         }
     }
     offload {
         hwnat enable
         ipv6 {
         }
     }
     static-host-mapping {
         host-name xxx {
             alias xxx.xxx.duckdns.org
             inet 192.168.1.xxx
         }
     }
     syslog {
         global {
             facility all {
                 level notice
             }
             facility protocols {
                 level debug
             }
         }
         host 192.168.1.203 {
             facility all {
                 level warning
             }
         }
     }
     time-zone Asia/Tokyo
     traffic-analysis {
         dpi enable
         export enable
     }
 }
特に説明はいらないでしょう。それぞれの環境に合わせて設定してください。

次回は、IPv6+DS-LiteとPPPoEが正しく動いているか確認したいと思います。

0 件のコメント:

コメントを投稿

NuxtからGatsbyに変えてLighthouseで100点を目指す、ついでにPWA対応もしてみた。

Nuxt から Gatsby に変えて Lighthouse の点数が 92 点まで上がりました。今回はさらに 100 点を目指したいと思います。ついで PWA に対応したいと思います。 SEO対応のため、NuxtからGatsbyに変更、さらにLighthouseを...