kstm-su / ictsc2018_kstm

0 stars 0 forks source link

スーパーファミコンの後継機, その名はN64! #18

Closed Noiri closed 5 years ago

Noiri commented 5 years ago

問題

あなたはとある会社のNOCに所属しています。 ある日、どこぞのセミナーから帰ってきた無能な上司に「知ってる? IPv4アドレスって数が少なくて枯渇してるんだよ? これからはIPv6の時代! 社内LANではIPv4禁止ね。 明日までによろしく!」と言い渡された。

さて、やれと言われたらやらなくてはならない。 しかし、クライアントがIPv6アドレスしか持たなくなると、IPv4アドレスしか持ってないWebサイトにアクセスできなくなってしまう。 どうやら、NAT64/DNS64という技術を使うといいらしい。

NAT64/DNS64を検証せよ。

情報

C IPアドレス: 192.168.3.1 ユーザー: admin パスワード: admin

R1 IPv6アドレス: fd00:31::71 ユーザー: admin パスワード: admin 備考: Clientを踏み台にする必要あり

問題のスタート状態

C,R1にsshできる R1からS1,S2それぞれにドメインでアクセスできる Cはeth0にIPv4アドレスとeth1にIPv6アドレスを持っている(R1から配布) R1にはunboundとjoolを導入済み

問題のゴール状態

R1でNAT64,DNS64の設定をして、CからS1,S2にドメインでアクセスできる
R1のDNS64はR2のDNSを参照する

curl server1.local curl server2.local

構成

03_yto_image

fono09 commented 5 years ago

R1にて下記のコマンドを実施しjoolを有効化。

root@16_03_router1_test:~# sysctl -w net.ipv4.conf.all.forwarding=1
net.ipv4.conf.all.forwarding = 1
root@16_03_router1_test:~# sysctl -w net.ipv6.conf.all.forwarding=1
net.ipv6.conf.all.forwarding = 1
root@16_03_router1_test:~# modprobe jool
root@16_03_router1_test:~# jool instance add "default" --iptables --pool6 64:ff9b::/96
root@16_03_router1_test:~# ip6tables -t mangle -A PREROUTING -d 64:ff9b::/96 -j JOOL --instance "default"
root@16_03_router1_test:~# iptables -t mangle -A PREROUTING -d 192.168.3.130 -p tcp --dport 61001:65535 -j JOOL --instance "default"
root@16_03_router1_test:~# iptables -t mangle -A PREROUTING -d 192.168.3.130 -p udp --dport 61001:65535 -j JOOL --instance "default"
root@16_03_router1_test:~# iptables -t mangle -A PREROUTING -d 192.168.3.130 -p icmp -j JOOL --instance "default"
fono09 commented 5 years ago

サーバへの到達を確認。

admin@16_03_client_test:~$ ping6 64:ff9b::192.168.3.202
PING 64:ff9b::192.168.3.202(64:ff9b::c0a8:3ca) 56 data bytes
64 bytes from 64:ff9b::c0a8:3ca: icmp_seq=1 ttl=62 time=1.78 ms
64 bytes from 64:ff9b::c0a8:3ca: icmp_seq=2 ttl=62 time=2.10 ms
fono09 commented 5 years ago

DNS64を設定 /etc/unbound/unbounc.confを下記のように編集

# Unbound configuration file for Debian.
#
# See the unbound.conf(5) man page.
#
# See /usr/share/doc/unbound/examples/unbound.conf for a commented
# reference config file.
#
# The following line includes additional configuration files from the
# /etc/unbound/unbound.conf.d directory.
include: "/etc/unbound/unbound.conf.d/*.conf"

+  server:
+     verbosity: 1
+     pidfile: "/var/run/unbound.pid"
+     module-config: "dns64 iterator"
+     dns64-prefix: 64:ff9b::/96
+     interface: ::0
+     access-control: ::0/0 allow
+ 
+ forward-zone:
+         name: "."
+         forward-addr: 192.168.3.131

systemctl restart unboundで適用。

クライアント側にて動作確認

admin@16_03_client_test:~$ curl server1.local
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Server 1</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
admin@16_03_client_test:~$ curl server2.local
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Server 2</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
fono09 commented 5 years ago

完答