내가 OpenWrt에서 ipv6을 비활성화 하는 이유는 일단 ipv6 주소체계가 익숙하지 않고 국내 isp는 개인에게 ipv6을 서비스 하지 않아 어차피 ipv6 이용이 불가하며, OpenWrt에서 ipv6을 활성화 해도 기능상의 문제가 있는것은 아니지만 dhcp에 의해 내부 클라이언트가 ipv6 주소를 할당받는 행위에 대한 log가 지저분해서 나는 ipv6을 비활성화 한다.
참고로 ipv4를 ipv6로 터널링 하는 서비스인 tunnelbroker.net을 이용해 ipv4와 ipv6 듀얼스택으로 구성해 본적이 있는데 ipv6의 경우 우리나라에서 가장 가까운 서버인 일본 도쿄를 이용해도 기존 ipv4보다 속도가 인터넷 서핑속도는 물론이고 속도 테스트 결과 1/2~1/3정도로 느려 메리트가 없었다. 문제는 듀얼스택 구성의 경우 ipv4 또는 ipv6 이용에 대한 우선순위 결정은 순전히 클라이언트의 권한으로 대부분의 경우(윈도우를 포함) ipv6이 ipv4보다 우선순위가 높기 때문에 상대적으로 빠른 ipv4 인터페이스를 놔두고 ipv6인터페이스를 통하게 되어 살짝 맛만보고 롤백하고 말았다. 좋은 서비스지만 테스트 목적이 아니라면 추천하고 싶지 않다.
어쨋든 다시 글을 주제로 돌아가서 OpenWrt에서 ipv6을 비활성화 하는법은 다음과 같다.
커널에서 ipv6 기능 끄기
sed -i -e '$i \sysctl -w net.ipv6.conf.all.disable_ipv6=1\nsysctl -w net.ipv6.conf.default.disable_ipv6=
1\nsysctl -w net.ipv6.conf.lo.disable_ipv6=1\necho 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6\n' /etc/rc.localcat /etc/rc.local
# Put your custom commands here that should be executed once # the system init finished. By default this file does nothing. sysctl -w net.ipv6.conf.all.disable_ipv6=1 sysctl -w net.ipv6.conf.default.disable_ipv6=1 sysctl -w net.ipv6.conf.lo.disable_ipv6=1 echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6 exit 0
참고) dns resolver를 unbound를 이용할 경우는 위를 적용하지 마시라. 4줄 가운데 구체적으로 어떤것 때문인지 모르겠지만 이것 때문에 unbound가 작동을 하지 않았다.
방화벽
기기로 input 되는 패킷과, 다른 zone으로 fowarding 되는 패킷을 drop한다.
uci add firewall rule
uci set [email protected][-1].name='Drop-IPv6-input'
uci set [email protected][-1].src='*'
uci set [email protected][-1].proto='all'
uci set [email protected][-1].family='ipv6'
uci set [email protected][-1].target='DROP'uci add firewall rule
uci set [email protected][-1].name='Drop-IPv6-forward'
uci set [email protected][-1].src='*'
uci set [email protected][-1].dest='*'
uci set [email protected][-1].proto='all'
uci set [email protected][-1].family='ipv6'
uci set [email protected][-1].target='DROP'uci reorder [email protected][-1]=0
uci reorder [email protected][-1]=0
uci commit firewallcat /etc/config/firewall
config rule option name 'Drop-IPv6-input' option src '*' option proto 'all' option family 'ipv6' option target 'DROP' config rule option name 'Drop-IPv6-forward' option src '*' option dest '*' option proto 'all' option family 'ipv6' option target 'DROP' ...
네트워크
인터페이스에서 ipv6과 내부 네트워크 ipv6 prefix 위임 비활성화하고, wan6은 부팅시 인터페이스를 켜지 않는다.
uci set network.lan.ipv6='0'
uci set network.wan.ipv6='0'
uci set network.wan6.ipv6='0'uci set network.lan.delegate='0'
uci set network.wan.delegate='0'
uci set network.wan6.delegate='0'uci set network.wan6.auto='0'
uci commit network
cat /etc/config/network
... config interface 'lan' ... option ipv6 '0' option delegate '0' config interface 'wan' ... option ipv6 '0' option delegate '0' config interface 'wan6' ... option ipv6 '0' option delegate '0' option auto '0' ...
dhcp/odhcpd
Router Advertisement 관련기능 및 dhcpv6을 비활성화하고 내부 네트워크 ipv6 주소 지정 (dhcpv6과 slaac) 데몬인 odhcpd-ipv6only 서비스 중지한다.
uci -q delete dhcp.lan.ra
uci -q delete dhcp.lan.ra_slaac
uci -q del_list dhcp.lan.ra_flags
uci set dhcp.lan.dhcpv6='disabled'
uci add_list dhcp.lan.ra_flags='none'uci -q del_list dhcp.wan.ra_flags
uci add_list dhcp.wan.ra_flags='none'
uci -q del_list dhcp.wan6.ra_flags
uci add_list dhcp.wan6.ra_flags='none'uci commit dhcp
/etc/init.d/odhcpd disable
cat /etc/config/dhcp
... config dhcp 'lan' ... option dhcpv6 'disabled' list ra_flags 'none' config dhcp 'wan' ... list ra_flags 'none' config dhcp 'wan6' ... list ra_flags 'none' ...
재부팅
설정을 마치고 재부팅한다.
reboot
네트워크에 오타가 있네요
uci set 'network.lan.ipv6='0'
알려주셔서 감사합니다. 수정하겠습니다.