xiaozong

例如我的eth0网卡信息如下

eth0      Link encap:Ethernet  HWaddr 00:0C:29:AA:B2:CA  
          inet addr:192.168.79.135  Bcast:192.168.79.255  Mask:255.255.254.0
          inet6 addr: fe80::20c:29ff:feaa:b2ca/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:208685 errors:0 dropped:0 overruns:0 frame:0
          TX packets:53443 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:42393010 (40.4 MiB)  TX bytes:18010745 (17.1 MiB)

现在我想把我的本地IP固定成192.168.79.133(用虚拟机的童鞋都知道,IP老是变化好麻烦)

1.查看网关地址,我的是192.168.79.2

[root@zongbh-centos6 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.78.0    0.0.0.0         255.255.254.0   U     1      0        0 eth0
0.0.0.0         192.168.79.2    0.0.0.0         UG    0      0        0 eth0

2.查看DNS,我的是192.168.79.2

[root@zongbh-centos6 ~]#  cat /etc/resolv.conf
# Generated by NetworkManager
search 7
nameserver 192.168.79.2

3.配置网卡信息,我的是 vim /etc/sysconfig/network-scripts/ifcfg-eth0

   配置信息如下

DEVICE="eth0"IPV6INIT="yes"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"BOOTPROTO=static
DNS1=192.168.79.2
IPADDR=192.168.79.133
NETMASK=255.255.254.0
GATEWAY=192.168.79.2

 

分类:

技术点:

相关文章:

  • 2022-01-08
  • 2021-10-31
  • 2021-06-07
  • 2021-05-22
  • 2021-10-20
  • 2021-05-29
  • 2021-07-02
猜你喜欢
  • 2021-12-04
  • 2021-07-07
  • 2021-12-04
  • 2022-01-19
  • 2021-08-26
  • 2022-01-02
相关资源
相似解决方案