1.查看网卡名称
#ifconfig (相当于windows 下的 ipconfig)
vr0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
ether 00:21:27:ac:52:9f
media: Ethernet autoselect (none)
status: no carrier
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=3<RXCSUM,TXCSUM>
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
确定网卡名称为“vr0”,"lo0"是循回口,不要管它。
2.配置IP
Free#vi /etc/rc.conf (这里配置Hostname、IP、Gateway)
按键盘“a”进入编辑状态输入以下内容(如果输错了,要删除某个字符,先按“esc”,然后光标移到欲删除的字符上,按“x”进行删除):
hostname="Free"
ifconfig_vr0="inet 192.168.10.3 netmask 255.255.255.0"
defaultrouter="192.168.10.254"
确认无误后,按“esc”退出编辑,然后按"shift" + ":" ,输入"wq",最后按“enter”键保存并退出。
~
~
~
~
~
~
:wq
3.配置DNS
Free#vi /etc/resolv.conf
编辑如以下内容(DNS视实际情况而定)
nameserver 202.96.209.5
nameserver 8.8.8.8
保存方法与配IP一致
4.reboot (重启吧,)
5.test
Free#ping baidu.com
PING baidu.com (220.181.111.85): 56 data bytes
64 bytes from 220.181.111.85: icmp_seq=0 ttl=52 time=482.829 ms
64 bytes from 220.181.111.85: icmp_seq=1 ttl=52 time=489.198 ms
转载于:https://blog.51cto.com/wowking/799017