gentoo 网络配置

假定用户已配置好内核和硬盘,使用的网卡是eth0.

首先先建立符号链接

root #cd /etc/init.d
root #ln -s net.lo net.eth0
所有的网络接口都在/etc/conf.d/net里配置,下面是一些示例
# For DHCP
config_eth0="dhcp"
  
# For static IP using CIDR notation
config_eth0="192.168.0.7/24"
routes_eth0="default via 192.168.0.1"
dns_servers_eth0="192.168.0.1 8.8.8.8"
  
# For static IP using netmask notation
config_eth0="192.168.0.7 netmask 255.255.255.0"
routes_eth0="default via 192.168.0.1"
dns_servers_eth0="192.168.0.1 8.8.8.8"

CIDR是一个ip爆满的解决方案,允许一个IP地址指定许多IP地址

现在配置完成了,我们可以启动或者关闭它

root #/etc/init.d/net.eth0 start
root #/etc/init.d/net.eth0 stop
 
tips:网络不一定叫net.eth0  请用ifconfig -a 来看看网卡具体叫什么名字,再前面建立软连接到net.lo的时候也用那个网卡的名字  /etc/conf.d/net里的名称也要用新的网卡名称 详情请参考http://allogs.ml/linux/linux%E5%AE%B6%E6%97%8F%E7%A5%9E%E5%99%A8-gentoo%E5%AE%89%E8%A3%85%E9%83%A8%E7%BD%B2%E6%95%99%E7%A8%8B-%E5%AE%89%E8%A3%85%E5%85%A8%E7%A8%8B%E7%AC%94%E8%AE%B0.html
 
下一步就是在引导的时候开启网卡
root #rc-update add net.eth0 default
root #rc
 
 
到这我们网络就配置好了,具体的其他详情信息请查看wiki帮助文档
https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Networking
 
 
posted @ 2017-01-18 17:04  愚智  阅读(1691)  评论(0编辑  收藏  举报