Network configuration with Calculate utilities¶
- Network configuration with Calculate utilities
- Specifying the IP address
- Routing setup
- Specifying DNS
- Getting network settings by DHCP
- Specifying the network manager
- Resetting the network in the current system
Since version 2.2.17, you can specify network settigns in calculate-install
such as IP address, routing table, DNS, network manager: to do so, you must use, respectively, --ip
, --route
, --dns
, --dhcp
, --netconf
.
If you do not specify these options, their values will default to the current system settings (such as the current IP and mask, the running network manager, the effective routing table). They will be displayed as the network you see before installation:
Network services * Network manager: openrc * DNS: 192.168.1.2 ... Network devices +------------+-----------------------+-------------------+----------------+ | Device | Name | MAC address | IP address | +------------+-----------------------+-------------------+----------------+ | eth0 | Realtek RTL8111/8168B | 00:24:1d:d1:41:83 | 192.168.1.3/24 | +------------+-----------------------+-------------------+----------------+ Routing +------------+----------------+-------------+-------------+ | Device | Network | Gateway | Source IP | +------------+----------------+-------------+-------------+ | eth0 | 192.168.1.0/24 | | 192.168.1.3 | | eth0 | default | 192.168.1.1 | | +------------+----------------+-------------+-------------+
Depending on whether you use openrc
or networkmanager
, setup will be performed in /etc/NetworkManager/system-connections
or /etc/conf.d/net
(_since version 2.2.17 this file is not transferred from the old system, but a new one is created). If you are an openrc
user, symplinks pointing to net.ethX will be created automatically.
Specifying the IP address¶
To set an IP address with a mask (specified as CIDR) for an interface, the --ip
option is used (if you have only one interface to setup, you do not have to specify it).
# install the ditribution with mask 255.255.255.0 for eth0 192.168.1.5 cl-install --ip eth0:192.168.1.5/24 # or cl-install --ip 192.168.1.5/24 # install the distribution with mask 255.255.255.0 for eth0 192.168.1.10 and mask 255.0.0.0 for eth1 10.0.0.5 cl-install --ip eth0:192.168.1.10/24 --ip eth1:10.0.0.5/8
Routing setup¶
To specify the gateway and the routing table, use the --route
option. By default, routes are taken from the current routing table, where the specified network settings are replaced. To remove a route for a network, you must specify the network but not the gateway. The syntax for specifying a route is: <NETWORK or DEFAULT>:<GATEWAY or empty>:<network interface>:<src ip>.
# setting default gateway 192.168.1.1 cl-install --ip 192.168.1.50 --route default:192.168.1.1 # tell the system to send packages to network 10.0.50.0/24 by router 192.168.1.5 cl-install --ip 192.168.1.50 --route default:192.168.1.1 --route 10.0.50.0/24:192.168.1.5For a router with IPsec tunneling, it may prove helpful to specify the IP address that will be used to send packages to the network at the other end of the tunnel. For example, for tunneling a connection between 192.168.1.0/24 and 192.168.2.0/24, you will have to tell explicitly that packages be sent to 192.168.2.0/24 from 192.168.1.5.
cl-install --route 192.168.2.0/24::eth0:192.168.1.5
Specifying DNS¶
The --dns
option specifies the DNS
server; if not stated explicitly, the current value will be set. If you have several DNS
servers, they should be comma-separated.
cl-install --dns 192.168.1.1,8.8.8.8
Getting network settings by DHCP¶
If you want you network interface to be configured by DHCP
, used the --dhcp
option: this is where you can specify which interface will be DHCP
-configured.
# eth0, eth2 by DHCP eth1, static cl-install --dhcp eth0 --ip eth1:192.168.1.1/24 --dhcp eth2
Specifying the network manager¶
To choose the network manager, you should use the --netconf
option.
# use openrc cl-install --netconf openrc # use networkmanager cl-install --netconf networkmanager
Resetting the network in the current system¶
If you need to reset the network in your current system, use the --startup
option and set the variable os_install_net_settings
to empty.
cl-setup-network --netconf openrc --ip 192.168.1.5 --hostname host.local --dns 192.168.1.1 --route default:192.168.1.1:eth0:192.168.1.5Then reboot: your network will be reset.