Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added rudimentary IPv6 support (#17) #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions configs/netns
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

# IP address of the interface in the global netns connecting to your new netns
#IPADDR_OUTSIDE=192.168.1.1/24
#IP6ADDR_OUTSIDE=2a00::1/126

# If you need DHCP
# In order for this to function for netns-tunnel and
Expand All @@ -22,8 +23,10 @@

# IP address of the interface in the new netns connecting to the global netns
#IPADDR=192.168.1.2/24
#IP6ADDR=2a00::2/126
# The gateway
#GATEWAY=192.168.1.1/24
#GATEWAY6=2a00::1

# If you need static MAC
#MACADDR=00:11:22:33:44:55
Expand Down
15 changes: 15 additions & 0 deletions scripts/netnsinit
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ autoconfigure_tunnel_up_outside() {
ip address add "${IPADDR_OUTSIDE}" dev "${DEVNAME_OUTSIDE}"
fi

# add ipv6 address at global end
if [ -n "${IP6ADDR_OUTSIDE}" ]; then
ip -6 address add "${IP6ADDR_OUTSIDE}" dev "${DEVNAME_OUTSIDE}"
fi

return 0 # additional precation against "set -e" in case of future mods of this function
}

Expand All @@ -39,11 +44,21 @@ autoconfigure_tunnel_up_inside() {
ip address add "${IPADDR}" dev "${DEVNAME_INSIDE}"
fi

# add ipv6 address at netns end
if [ -n "${IP6ADDR}" ]; then
ip -6 address add "${IP6ADDR}" dev "${DEVNAME_INSIDE}"
fi

# setup default route
if [ -n "${GATEWAY}" ]; then
ip route add default via "${GATEWAY%%/*}" dev "${DEVNAME_INSIDE}" onlink
fi

# setup default route
if [ -n "${GATEWAY6}" ]; then
ip -6 route add default via "${GATEWAY6%%/*}" dev "${DEVNAME_INSIDE}" onlink
fi

# if DHCP is configured
if [ "${DHCPV4}" == "1" ]; then
! mkdir -p /var/run/netns
Expand Down