1 # Container Networking {#sec-container-networking}
3 When you create a container using `nixos-container create`, it gets it
4 own private IPv4 address in the range `10.233.0.0/16`. You can get the
5 container's IPv4 address as follows:
8 # nixos-container show-ip foo
12 64 bytes from 10.233.4.2: icmp_seq=1 ttl=64 time=0.106 ms
15 Networking is implemented using a pair of virtual Ethernet devices. The
16 network interface in the container is called `eth0`, while the matching
17 interface in the host is called `ve-container-name` (e.g., `ve-foo`).
18 The container has its own network namespace and the `CAP_NET_ADMIN`
19 capability, so it can perform arbitrary network configuration such as
20 setting up firewall rules, without affecting or having access to the
23 By default, containers cannot talk to the outside network. If you want
24 that, you should set up Network Address Translation (NAT) rules on the
25 host to rewrite container traffic to use your external IP address. This
26 can be accomplished using the following configuration on the host:
29 networking.nat.enable = true;
30 networking.nat.internalInterfaces = ["ve-+"];
31 networking.nat.externalInterface = "eth0";
34 where `eth0` should be replaced with the desired external interface.
35 Note that `ve-+` is a wildcard that matches all container interfaces.
37 If you are using Network Manager, you need to explicitly prevent it from
38 managing container interfaces:
41 networking.networkmanager.unmanaged = [ "interface-name:ve-*" ];
44 You may need to restart your system for the changes to take effect.