动态主机配置协议DHCP
yum list 包名* 可查询包名
yum list 包名* 查询包名
··············································
通过克隆一个服务器,网卡直接变成eth2,怎么修改呢?
方法一:
vim /etc/udev/rules.d/70-persistent-net.rules
里面有mac地址及网卡名
把eth1/eth2删掉,并把eth2修改为eth0
使其生效,方法:卸装载网卡驱动
找到eth2的网卡驱动名
方法一:dmesg | grep -i eth
方法二:ethtool -i eth2
卸载命令:modprobe -r e1000
装载命令:modeprobe e1000
······································································
本地拷贝虚拟机文件,会产生mac地址冲突(一致)
在原机上点击设置→网卡→高级→生成
重启服务器
修改网卡名称
设置IP也有图形界面设置,set up 选第四个
·································································
ifconfig 显示的是活动的网卡 -a 显示所有的网卡
·······························································
禁用网卡 ifconfig eth1 down(广泛性)
启用网卡 ifconfig eth1 up
命令禁用网卡 (局限性)
ifdown eth1
输入ifconfig,eth1的IP就没了
命令启用网卡
ifup eth1
如有不能禁用,则是没有该eth1的配置文件(创建/etc/sysconfig/network-scripts/ifcfig-eth1)
·······························································
用ifconfgi设置IP地址 (临时性更改)
ifconfig eth1 1.1.1.1/24
ifconfig eth1 down
ifconfig eth1 up(则恢复原IP)如无IP配置文件,则无ip
·······························································
用ifconfig查看网卡是否支持广播
UP BROADCAST
·······························································
查看物理网络(网线、水晶头)是否正常:
1.用ifconfig查看接收发送包
输入ifconfig后,RX是接收包,TX是发送包,在VMware中手动断开网络连接(拔网线),这两个值就不变了
2.ip link 查看是否up或者down
·································································································································
route 命令
查看 route -n
添加 route add
添加主机:route -host 6.6.6.6 gw 3.3.3.100 dev eth1
添加网络:route -net 8.8.8.8 netmask 255.255.255.255 gw 3.3.3.100
添加网段: route add -net 10.0.0.0 netmask 255.0.0.0 gw 192.168.30.100
注意网关是要和网卡接口是在同一个网段上
添加默认网络:route add default gw 192.168.30.2
········································································
删除默认网络:route del default gw 192.168.30.2
删除主机:route del -host 6.6.6.6
删除网段:route del -net 100.0.0.0 netmask 255.0.0.0
网络重启:service network restart
·····················································
在两台服务器上,一个RSa(C7),一个RSb(C6),物理上在一块同一个交换机下。
RSaIP:192.168.1.100/24
RSbIP:192.168.2.100/24
两者要通信,则需要在路由上做配置
RSa:route add default dev ens37 只要是未知网络,从ens37网络发出去,都能接收
RSb:route add default dev eth1 只要是未知网络,从eth1网络发出去,都能接收
因为两台服务器因为物理上是一个网段的,能通信的
································································
两台服务器物理上在一个网段的,服务器IP配置也是对的,查看两台路由表,是否有该网段的路由记录,没有则添加。