klee network create
Create a new network.
Usage
$ klee network create [OPTIONS] NAME
Refer to the options section for an overview of available OPTIONS
for this command.
Description
Creates a new network using a specific subnet and network type.
The --type
can be either loopback
, bridge
or custom
and defaults to loopback
.
The --subnet
or --subnet6
option needs to be specified when creating a new network,
following the CIDR-notation, e.g., 192.168.1.1/24
.
To know more about the different network types and other topics related to container networking, see the container networking section.
For example uses of this command, refer to the examples section below.
Options
Name, shorthand | Default | Description |
--type , -t |
What kind of network should be created. Possible values are 'bridge', 'loopback', and 'custom'. [default: loopback] | |
--interface , -i |
Name of the interface used on the host for the network.
If not set the interface name is set to 'kleened' postfixed with an integer.
If type is set to 'custom' the value of interface must be the name of an existing interface. |
|
--subnet |
Subnet in CIDR format for the network | |
--subnet6 |
IPv6 subnet in CIDR format for the network | |
--gw |
VNET+bridge only. The default IPv4 router that is added to 'vnet' containers on startup, if subnet is set.
If set to 'auto' the first IP of subnet is added to the bridge and used as a gateway (default).
Setting --gw="" disables adding a gateway. |
|
--gw6 |
VNET+bridge only. The default IPv6 router that is added to 'vnet' containers, if subnet6 is set.
See gw for details. |
|
--nat |
Whether or not to use NAT for the network's outgoing traffic. Default is to use NAT, use --no-nat to disable it. |
|
--nat-if |
Specify which interface to NAT the IPv4 network traffic to.
Defaults to the host's gateway interface. Ignored if no-nat is set. |
|
--icc |
Whether or not to enable connectivity between containers within the same network. [default: True] | |
--internal |
Whether or not the network is internal, i.e., not allowing outgoing upstream traffic | |
--help |
Show this message and exit. |
Examples
Creating a loopback network
Creating a network is as simples as:
$ klee network create --subnet=192.168.0.0/16 testnet
b5a603dcd304
This will create a new loopback network, with a corresponding loopback interface
that can be viewed with ifconfig
.
If no other networks have been created with Kleene, the interface name will be kleene0
.
Creating a bridge network
A new loopback network can be created like this:
$ klee network create --type=bridge --interface mynet --subnet=10.2.3.0/24 mynet
657e12442ff0
This will create a new bridge interface on the host named mynet
for the network:
$ ifconfig mynet
mynet: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 58:9c:fc:10:30:3d
inet 10.2.3.1 netmask 0xffffff00 broadcast 10.2.3.255
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
groups: bridge
nd6 options=9<PERFORMNUD,IFDISABLED>
Parent command
Command | Description |
---|---|
klee network | Manage networks |