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”