Gentoo网络管理方法总结

时间:2022-06-27 08:12:34

OpenRC/netifrc

Netifrc is a collection of modules created to configure and manage network interfaces via individual, per-interface scripts located in the /etc/init.d/ directory.

Enable Gentoo's network stack (net.* scripts).

检测网卡名字

ifconfig -a
or
ls /sys/class/net

添加网卡

通过net.lo链接

ln -s /etc/init.d/net.lo /etc/init.d/net.ifname
/etc/init.d/net.ifname start
rc-update add net.ifname default

配置网络IP

编辑/etc/conf.d/net文件

config_ifname="192.168.1.10/24"    #ip、掩码
routes_ifname="default via 192.168.1.1" #网关

添加DNS

编辑`/etc/resolv.conf文件

nameserver 202.99.166.4
nameserver 202.99.160.68

Newnet

enable the new network stack (experimental)

DHCPCD

Dynamic Host Configuration Protocol Client Daemon (DHCPCD) is a popular DHCP client for Gentoo Linux users.

使用dhcpcd自动获取IP,需要将net.*scripts标本停用,并设置/etc/conf.d/netconfig_ifname="dhcp"或留空。

dhcpcd-ui

https://wiki.gentoo.org/wiki/Dhcpcd-ui#Usage

  • dhcpcd-gtk

NetworkManager

NetworkManager is a network management software for Ethernet, Wifi, DSL, dialup, VPN, WiMAX and mobile broadband network connections.

It's a good idea to use dhclient from net-misc/dhcp instead of net-misc/dhcpcd.

NetworkManager GUI

参考:

Network management

Network_management_using_DHCPCD/OpenRC_message

Netifrc

Network management using DHCPCD

NetworkManager