1 Last login: Sat Oct 14 16:19:13 2017 2 # 进入ip凭证文件设置地方 3 [root@oracle ~]# cd /etc/sysconfig/network-scripts/ 4 [root@oracle network-scripts]# pwd 5 /etc/sysconfig/network-scripts 6 [root@oracle network-scripts]# cat ifcfg-eth0 7 # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) 8 DEVICE=eth0 #设备名称 9 BOOTPROTO=static #静态ip 10 TYPE=Ethernet #网络类型 11 BROADCAST=192.168.242.255 12 HWADDR=00:0C:29:4F:06:9C 13 IPADDR=192.168.242.10 #静态ip地址 14 DNS1=192.168.242.1 #dns 15 IPV6INIT=yes 16 IPV6_AUTOCONF=yes 17 NETMASK=255.255.255.0 #子网掩码 18 GATEWAY=192.168.242.1 #网关 19 ONBOOT=yes #开机自启动 20 [root@oracle network-scripts]# 21 [root@oracle network-scripts]# 22 [root@oracle network-scripts]# 23 [root@oracle network-scripts]# service network restart #---重新启动网络服务 24 Shutting down interface eth0: [ OK ] 25 Shutting down loopback interface: [ OK ] 26 Disabling IPv4 packet forwarding: net.ipv4.ip_forward = 0 27 [ OK ] 28 Bringing up loopback interface: [ OK ] 29 Bringing up interface eth0: [ OK ] 30 [root@oracle network-scripts]# ifconfig 31 eth0 Link encap:Ethernet HWaddr 00:0C:29:4F:06:9C 32 inet addr:192.168.242.10 Bcast:192.168.242.255 Mask:255.255.255.0 33 inet6 addr: fe80::20c:29ff:fe4f:69c/64 Scope:Link 34 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 35 RX packets:59 errors:0 dropped:0 overruns:0 frame:0 36 TX packets:61 errors:0 dropped:0 overruns:0 carrier:0 37 collisions:0 txqueuelen:1000 38 RX bytes:4689 (4.5 KiB) TX bytes:15386 (15.0 KiB) 39 Base address:0x2000 Memory:fd5c0000-fd5e0000 40 41 lo Link encap:Local Loopback 42 inet addr:127.0.0.1 Mask:255.0.0.0 43 inet6 addr: ::1/128 Scope:Host 44 UP LOOPBACK RUNNING MTU:16436 Metric:1 45 RX packets:2040 errors:0 dropped:0 overruns:0 frame:0 46 TX packets:2040 errors:0 dropped:0 overruns:0 carrier:0 47 collisions:0 txqueuelen:0 48 RX bytes:3591288 (3.4 MiB) TX bytes:3591288 (3.4 MiB) 49 50 virbr0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 51 inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0 52 inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link 53 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 54 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 55 TX packets:40 errors:0 dropped:0 overruns:0 carrier:0 56 collisions:0 txqueuelen:0 57 RX bytes:0 (0.0 b) TX bytes:9692 (9.4 KiB) 58