aldshengdeng

在目录/etc/sysconfig/network/中需要关注三个文件

ifcfg-eth* :配置网络地址

ifroute-eth* :定义每个接口的路由

routes:指定各种系统任务所需的所有静态路由

编辑/etc/sysconfig/network/ifcfg-eth0文件配置需要的IP地址

BOOTPROTO=\'static\'   #静态IP
BROADCAST=\'10.150.36.255\'   #广播地址
IPADDR=\'10.150.36.199\'   #IP地址
NETMASK=\'255.255.255.0\'   #子网掩码
NETWORK=\'10.150.36.0\'   #网络地址
STARTMODE=\'auto\'    #开机启动网络

编辑/etc/sysconfig/network/ifroute-eth* 文件 指定以上ip 对应的默认网关地址

default 10.150.36.1 - eth0

如果机器中需要添加其他的路由,则需要编辑/etc/sysconfig/network/routes 文件

例如:

# Destination          Dummy/Gateway           Netmask                Device
#
180.200.0.0           10.200.6.201               255.255.0.0              eth0
180.200.3.170         10.200.6.201               255.255.255.255          eth0

设置DNS

编辑/etc/resolv.conf

nameserver=8.8.8.8

 重启网络

#service network restart

参考命令

ip route show  #查看路由信息
netstat -r # 可查看网关地址
route add default 10.150.36.1 dev eth0 #临时配置默认网关地址
rcnetwork restart #重启网络服务

 

分类:

技术点:

相关文章:

  • 2021-11-23
  • 2021-10-16
  • 2021-09-13
  • 2021-12-11
  • 2021-05-16
  • 2021-04-24
  • 2022-01-15
  • 2021-10-19
猜你喜欢
  • 2021-05-17
  • 2021-08-24
  • 2021-11-04
  • 2021-11-22
  • 2021-09-08
  • 2021-12-14
  • 2021-12-12
相关资源
相似解决方案