FreeBSD配置IP地址


一:手动配置IP地址
ipconfig fxp0 192.168.1.33/24     添加网卡IP
route add default 192.168.1.1     添加网关

注明:立即生效  但重启失效

二:在配置文件配置IP地址
ee /etc/rc.conf
ifconfig_fxp0="inet 192.168.1.1

netmask 255.255.255.0 "   #fxp0 网卡地址和子网掩码
defaultrouter="192.168.1.1"     #网关
hostname=www.fantefei.com         #主机名

启动服务
/etc/netstart     网卡服务


三:DHCP 分配IP地址
vim /etc/rc.conf
ifconfig_fxp0="DHCP"

启动服务
/etc/netstart     网卡服务


四:DNS配置
vi /etc/resolv.conf
domain          fantefei

nameserver      202.106.0.20
nameserver      8.8.8.8


五:控制网卡的开关
ifconfig fxp0 up
ifconfig fxp0 down

六:查看路由
netstat -rn