FreeBSD系统网卡相关配置方法:
先通过ifconfig可查看配置情况
1、可通过以下命令
ifconfig lnc0 10.0.0.111 netmask 255.255.255.0
但是该方法只适用于即时生效,机器重启后,信息不保留,不建议
2、打开/etc/rc.conf
加入或修改:ifconfig_网卡名称=“inet x.x.x.x netmask x.x.x.x”
添加 ifconfig_xxx = “inet x.x.x.x netmask x.x.x.x”
随后 reboot
如果不想重启的话,可执行 sh /etc/rc
如果要设置多个IP地址可用别名方式
修改如下:
ifconfig_lnc0=“inet 10.0.0.199 netmask 255.255.255.0”
改为
ifconfig_lnc0_alias0=“inet 10.0.0.198 netmask 255.255.255.0”
ifconfig_lnc0_alias1=“inet 10.0.0.197 netmask 255.255.255.0”