linux系统修改ip地址方法

一、查看当前ip地址

[root@localhost ~]# ifconfig

eth2       Link encap:Ethernet  HWaddr 00:10:18:AB:08:C4 
          inet addr:210.32.137.153
  Bcast:210.32.137.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1034809 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1057 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:75945272 (72.4 MiB)  TX bytes:1117565 (1.0 MiB)
          Interrupt:177 Memory:9a000000-9a7fffff

eth3      Link encap:Ethernet  HWaddr 00:10:18:AB:08:C6 
          inet addr:10.1.2.11  Bcast:10.1.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:697242 errors:0 dropped:0 overruns:0 frame:0
          TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:45557850 (43.4 MiB)  TX bytes:3457 (3.3 KiB)
          Interrupt:178 Memory:9a800000-9affffff

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:15555 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15555 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4651095 (4.4 MiB)  TX bytes:4651095 (4.4 MiB)

usb0      Link encap:Ethernet  HWaddr 5E:F3:FC:7D:88:8F 
          inet addr:169.254.95.120  Bcast:169.254.95.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:31769 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15930 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2146178 (2.0 MiB)  TX bytes:760683 (742.8 KiB)

 

二、查看当前ip地址配置文件

[root@localhost ~]# more /etc/sysconfig/network-scripts/ifcfg-eth2

# Broadcom Corporation NetXtreme II BCM57711 10-Gigabit PCIe
DEVICE=eth2
BOOTPROTO=none
HWADDR=00:10:18:AB:08:C4
ONBOOT=yes
HOTPLUG=no
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=210.32.137.153

USERCTL=no
IPV6INIT=no
PEERDNS=yes
GATEWAY=210.32.137.1

 

 

 三、修改ip地址配置文件

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth2

 

 四、重启系统使其生效

[root@localhost ~]# reboot

你可能感兴趣的:(linux)