Difference between revisions of "IPv6: Router Ubuntu"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) |
Onnowpurbo (talk | contribs) |
||
Line 122: | Line 122: | ||
default-lease-time 600; | default-lease-time 600; | ||
max-lease-time 7200; | max-lease-time 7200; | ||
+ | option dhcp6.next-hop 2a07:1c44:212:c0ca:87e8::2; | ||
subnet6 2a07:1c44:212:c0ca:87e8::/80 { | subnet6 2a07:1c44:212:c0ca:87e8::/80 { | ||
range6 2a07:1c44:212:c0ca:87e8:: 2a07:1c44:212:c0ca:87e8::3000; | range6 2a07:1c44:212:c0ca:87e8:: 2a07:1c44:212:c0ca:87e8::3000; |
Revision as of 14:00, 5 February 2019
Berikut adalah langkah yang perlu dilakukan untuk membuat sebuah router IPv6 sederhana menggunakan Ubuntu.
Akses ke IPv6 Internet
Perhitungan Subnet IPv6
NAT IPv6
Jika dibutuhkan, maka netfilter6 dapat digunakan sebagai NAT IPv6.
IPv6 Masquerading
Seperti layaknya client IPv4, maka client dapat di sembunyikan di belakang router dengan IPv6 masquerading (hide/overlap NAT), seperti
ip6tables -t nat -A POSTROUTING -o tun0 -s fec0::/64 -j MASQUERADE ip6tables -t nat -A POSTROUTING -o teredo -s 2001:0:53aa:64c:20a7:659c:4b0c:e8d7 -j MASQUERADE
IPv6 Destination NAT
Sebuah dedicated IPv6 address global dapat di forward ke internal IPv6 address, seperti,
ip6tables -t nat -A PREROUTING -d 2001:db8:0:1:5054:ff:fe01:2345 -i tun0 -j DNAT --to-destination fec0::5054:ff:fe01:2345
IPv6 Port Forwarding
Sebuah port yang spesifik dapat di forward ke jaringan internal, seperti,
ip6tables -t nat -A PREROUTING -i tun0 -p tcp --dport 8080 -j DNAT --to-destination [fec0::1234]:80
Siapkan OS Ubuntu
Skenario 1: teredo dan Alokasi Stateless untuk LAN lokal
GATEWAY / Router ke Internet
Install radvd
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding ip addr add fec0:1234::dead/64 dev enp0s3 sudo apt install radvd
Edit /etc/radvd.conf
interface enp0s3 { AdvSendAdvert on; prefix fec0:1234::/64 { }; };
Restart
/etc/init.d/radvd restart
NAT ke IPv6 Global
ip6tables -t nat -A POSTROUTING -i enp3s0 -o teredo -s fec0:1234::/64 -j MASQUERADE
Skenario 2: 6project dan IPv6 Static LAN lokal
GATEWAY / Router ke Internet
openvpn --config usernameanda-di-6project.ovpn &
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding ip addr del 2a07:1c44:212:c0ca:87e8::/80 dev tun0 ip addr add 2a07:1c44:212:c0ca:87e8:8000::1/81 dev tun0 ip addr add 2a07:1c44:212:c0ca:87e8:0000::dead/81 dev enp0s3 ip route add ::/0 dev tun0
Flush firewall
ip6tables -t nat -F ip6tables -F
CLIENT
ip addr add 2a07:1c44:212:c0ca:87e8:0000::123/81 dev enp0s3 ip route add ::/0 via 2a07:1c44:212:c0ca:87e8:0000::dead
atau
ip route add ::/0 dev enp0s3
Cek
dig aaaa ipv6.google.com ping6 ipv6.google.com
Skenario 3: 6project alokasikan DHCPv6 LAN
openvpn --config usernameanda-di-6project.ovpn &
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding ip addr del 2a07:1c44:212:c0ca:87e8::/80 dev tun0 ip addr add fec0::/80 dev tun0 ip route add ::/0 dev tun0 ip addr add 2a07:1c44:212:c0ca:87e8::2/80 dev enp0s3
DHCPv6 server
apt install isc-dhcp-server chmod -Rf 777 /var/lib/dhcp/ chown -Rf nobody: /var/lib/dhcp/
Edit /etc/dhcp/dhcpd6.conf
default-lease-time 600; max-lease-time 7200; option dhcp6.next-hop 2a07:1c44:212:c0ca:87e8::2; subnet6 2a07:1c44:212:c0ca:87e8::/80 { range6 2a07:1c44:212:c0ca:87e8:: 2a07:1c44:212:c0ca:87e8::3000; }
dhcpd -6 -cf /etc/dhcp/dhcpd6.conf
Flush firewall
ip6tables -t nat -F ip6tables -F
CLIENT