Solaris学习之网络配置
在虚拟机上安装好Solaris操作系统后,首先要进行网络配置,让系统能连上互联网。
1、首先查看网卡名称命令:#dladm show-link(后面配置需要用到网卡名称)
eg:
e1000g0 type: non-vlan mtu: 1500 device: e1000g0
e1000g1 type: non-vlan mtu: 1500 device: e1000g
2、查看系统网卡使用情况:#ifconfig -a
3、禁用网卡:#ifconfig e1000g0 unplumb
4、启用网卡:#ifconfig e1000g0 plumb
5、添加ip和子网掩码:ifconfig e1000g0 inet 10.1.3.23 netmask 255.255.255.0
6、以下进行文件配置
(1)、/etc/defaultrouter添加默认路由,注:defaultrouter文件需要自己建
bash-3.00# more defaultrouter
10.1.3.254
bash-3.00#
(2)、/etc/hostname.e1000g0为网卡添加主机名,注:和下面nodename文件里的主机名一致
bash-3.00# more hostname.e1000g0
solaris
bash-3.00#
(3)、/etc/nodename主机名
bash-3.00# more nodename
solaris
bash-3.00#
(4)、/etc/hosts
bash-3.00# more hosts
#
# Internet host table
#
::1 localhost
127.0.0.1 localhost
10.1.3.23 solaris loghost
bash-3.00#
(5)、/etc/resolv.conf设置域名和dns,最多可以添加三个
bash-3.00# more resolv.conf
domain china.com
nameserver 10.1.10.1
bash-3.00#
(6)、/etc/nsswitch.conf更改,在hosts file 后面添加dns
hosts:file dns
(7)、/etc/netmasks加入网段和掩码
10.1.3.0 255.255.255.0
若以上配置成功,重启计算机,vm上solaris系统可以上网