-
Notifications
You must be signed in to change notification settings - Fork 2
/
net
41 lines (26 loc) · 1.66 KB
/
net
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
ifconfig eth0 192.168.x.x
Замени eth0 на свой интерфейс (очевидно, но мало ли)
route add default gw <ip роутера>
Static IP addresses
In case the network interface card should be configured with a static IP address, add their data to /etc/dhcpcd.conf.[1] The following is an example of manually adding a static address, routes, and DNS by editing DHCPCD's configuration file using a text editor of choice:
FILE /etc/dhcpcd.conf
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
CONFIG:
https://wiki.gentoo.org/wiki/Handbook:X86/Networking/Modular
Interface handlers
We provide two interface handlers presently: ifconfig and iproute2. Only one of these is needed to do any kind of network configuration.
ifconfig is installed by default (the net-tools package is part of the system profile). iproute2 is a more powerful and flexible package, but it's not included by default.
root #emerge --ask sys-apps/iproute2
FILE /etc/conf.d/netiproute2 is installed but still prefer ifconfig
# To prefer ifconfig over iproute2 if both are installed as openrc prefers
# to use iproute2 then
modules="ifconfig"
As both ifconfig and iproute2 do very similar things we allow their basic configuration to work with each other. For example both the below code snippet work regardless of which module the user is using.
FILE /etc/conf.d/netExample different approaches for configuration
config_eth0="192.168.0.2/24"
config_eth0="192.168.0.2 netmask 255.255.255.0"
# We can also specify broadcast
config_eth0="192.168.0.2/24 brd 192.168.0.255"
config_eth0="192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"