1、Linux网络配置原理图(含虚拟机)

2、查看网络IP和网关
2.1、查看虚拟网络编辑器

2.2、修改ip地址(修改该虚拟网络的ip)

2.3、查看网关

2.4、查看windows环境中的VMnet8网络配置(ipconfig指令)
1)、使用ipconfig查看
2)界面查看

3、ping测试主机之间网络连通
3.1、基本语法
ping 目的主机
:测试当前服务器是否可以连接目的主机
4、linux网络环境配置
4.1、第一种方法(自动获取)

缺点:linux启动后会自动获取ip,缺点是每次获取的ip地址可能不一样,这个不适用于做服务器,因为我们的服务器的ip需要是固定的。
4.2、第二种方法(指定固定的ip)
说明:直接修改配置文件来指定IP,并可以连接到外网(程序员推荐),编辑/etc/sysconfig/network-scripts/ifcfg-eth0文件。
指令:vi /etc/sysconfig/network-scripts/ifcfg-eth0
要求:将ip地址配置为静态的,ip地址为192.168.152.130

主要配置有5个:
ONBOOT=yes
:启用boot配置成yesBOOTPROTO=static
:以静态方式获取ipIPADDR=192.168.152.130
:指定ipGATEWAY=192.168.152.2
:网关DNS1=192.168.152.2
:dns,这里和网关保持一致即可。
修改后,一定要重启服务。
1)、service network restart
2)、reboot
:重启系统


网友评论