Skip to content
James Swineson edited this page May 10, 2020 · 5 revisions

DNS Config Per Netns

Create a file named /etc/netns/your_netns_name/resolv.conf then start netns.

Preset config

You may need this if you use bridging or NAT mode.

Global config file is located at /etc/default/netns.

You can create individual config files for each netns named netns-foo to override global config.

Bridging

# Bridge name
BRIDGE=br0

# If you need DHCP
DHCPV4=1
# Or if you need static IP
#IPADDR=192.168.1.2
#CIDR=24
#GATEWAY=192.168.1.1

# If you need static MAC on device outside
#MACADDR=00:11:22:33:44:55

# Device name outside netns
DEVNAME_OUTSIDE=veth0
# Device name inside netns
DEVNAME_INSIDE=veth1

NAT

# Host IP
GATEWAY_IP=192.168.99.1
# Client (inside netns) IP
CLIENT_IP=192.168.99.2
# Needless to say
CIDR=30

# If you need static MAC on device outside
#MACADDR=00:11:22:33:44:55

# Device name outside netns
DEVNAME_OUTSIDE=veth0
# Device name inside netns
DEVNAME_INSIDE=veth1

Note: don't use IP ranges already used by your LAN or VPN connections.

Clone this wiki locally