CentOS系统下双网络IP信息的配置
2014-03-11 20:48
555 查看
关于Centos系统的网卡配置,相信大家都遇到过,大多时候只有一个网卡模式,但是有时我们需要两个网卡的时候,比如配置数据库集群的时候,需要一个浮动IP,我们该如何配置呢?下面带着这个问题,我们来逐步实现双网卡的配置过程。
一、系统环境:
1、Centos: 32位6.3版本;
2、虚拟机:VMware® Workstation 9.0.0 build-812388;
二、配置过程:
1、查看网卡配置:
[root@localhost ~]# ifconfig -a
显示结果:
2、Linux与Unix系统的一切配置都是在文件中实现的,那么我们来看看Centos系统的网卡及IP配置是如何实现的,打开/etc/sysconfig/network-scripts目录:
[root@localhost ~]# cd /etc/sysconfig/network-scripts
[root@localhost network-scripts]# ls -ls
通过ls -ls 命令可以看到有一个ifcfg-eth0的文件,这就是我们要找的网络IP配置文件。那么我们看看里面都有些什么内容?
[root@localhost network-scripts]# more ifcfg-eth0
在文件中,我们看到了ifconfig命令执行所看到的网卡的驱动、IP地址、以及DNS服务器等的配置信息,当然这是我先前配置好的文件。那么我们还能不能配置一个类似这样的网络IP的配置呢?答案是肯定的,那么该如何配置呢?请王往下走:
3、配置虚拟机的网络适配器:
A:虚拟机的菜单:VM-->Setting......,打开虚拟机的设置界面,如图所示:
B:选择“Add”按钮,在弹出的对话框中选择“Network Adapter”选项,如图所示:
C:点击“Next”按钮,在弹出的对话框中选择“Bridged”选项,如图所示:
D:点击“Finish”按钮,回到主界面,就可以看到我们新建的网卡适配器“Network Adapter 2”。
4、在目录/etc/sysconfig/network-scripts下配置网卡文件ifcfg-eth1文件:
[root@localhost network-scripts]# touch ifcfg-eth1
在文件中输入:
保存文件后,重新启动网络服务:
[root@localhost network-scripts]# service network restart
5、验证网络IP配置的成功与否:
[root@localhost network-scripts]# ifconfig -a
显示结果:
如果出现eth1的网卡IP等信息,就说明配置成功,否则配置失败。
一、系统环境:
1、Centos: 32位6.3版本;
2、虚拟机:VMware® Workstation 9.0.0 build-812388;
二、配置过程:
1、查看网卡配置:
[root@localhost ~]# ifconfig -a
显示结果:
eth0 Link encap:Ethernet HWaddr 00:0C:29:E6:68:51 inet addr:192.168.31.132 Bcast:192.168.31.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fee6:6851/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:98 errors:0 dropped:0 overruns:0 frame:0 TX packets:119 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:21284 (20.7 KiB) TX bytes:15269 (14.9 KiB) Interrupt:19 Base address:0x2024 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:16 errors:0 dropped:0 overruns:0 frame:0 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:960 (960.0 b) TX bytes:960 (960.0 b)
2、Linux与Unix系统的一切配置都是在文件中实现的,那么我们来看看Centos系统的网卡及IP配置是如何实现的,打开/etc/sysconfig/network-scripts目录:
[root@localhost ~]# cd /etc/sysconfig/network-scripts
[root@localhost network-scripts]# ls -ls
-rw-r--r--. 1 root root 287 Mar 6 19:04 ifcfg-eth0
通过ls -ls 命令可以看到有一个ifcfg-eth0的文件,这就是我们要找的网络IP配置文件。那么我们看看里面都有些什么内容?
[root@localhost network-scripts]# more ifcfg-eth0
DEVICE="eth0" #BOOTPROTO="dhcp" BOOTPROTO="static" HWADDR="00:0C:29:E6:68:51" #IPV6INIT="yes" IPV6INIT="no" IPADDR="192.168.31.132" NM_CONTROLLED="yes" ONBOOT="yes" TYPE="Ethernet" UUID="5ea8127a-4031-4d99-9adf-f810ed05a215" DNS1=192.168.31.2 #DEVICE=eth0 #BOOTPROTO=dhcp #ONBOOT=yes
在文件中,我们看到了ifconfig命令执行所看到的网卡的驱动、IP地址、以及DNS服务器等的配置信息,当然这是我先前配置好的文件。那么我们还能不能配置一个类似这样的网络IP的配置呢?答案是肯定的,那么该如何配置呢?请王往下走:
3、配置虚拟机的网络适配器:
A:虚拟机的菜单:VM-->Setting......,打开虚拟机的设置界面,如图所示:
B:选择“Add”按钮,在弹出的对话框中选择“Network Adapter”选项,如图所示:
C:点击“Next”按钮,在弹出的对话框中选择“Bridged”选项,如图所示:
D:点击“Finish”按钮,回到主界面,就可以看到我们新建的网卡适配器“Network Adapter 2”。
4、在目录/etc/sysconfig/network-scripts下配置网卡文件ifcfg-eth1文件:
[root@localhost network-scripts]# touch ifcfg-eth1
在文件中输入:
DEVICE=eth1 BOOTPROTO=static IPADDR=192.168.31.101 NETMASK=255.255.255.0 ONBOOT=yes
保存文件后,重新启动网络服务:
[root@localhost network-scripts]# service network restart
5、验证网络IP配置的成功与否:
[root@localhost network-scripts]# ifconfig -a
显示结果:
eth0 Link encap:Ethernet HWaddr 00:0C:29:E6:68:51 inet addr:192.168.31.132 Bcast:192.168.31.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fee6:6851/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:98 errors:0 dropped:0 overruns:0 frame:0 TX packets:119 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:21284 (20.7 KiB) TX bytes:15269 (14.9 KiB) Interrupt:19 Base address:0x2024 eth1 Link encap:Ethernet HWaddr 00:0C:29:E6:68:5B inet addr:192.168.31.101 Bcast:192.168.31.255 Mask:255.255.255.0 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:7 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1761 (1.7 KiB) TX bytes:0 (0.0 b) Interrupt:19 Base address:0x20a4 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:16 errors:0 dropped:0 overruns:0 frame:0 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:960 (960.0 b) TX bytes:960 (960.0 b)
如果出现eth1的网卡IP等信息,就说明配置成功,否则配置失败。
相关文章推荐
- CentOS 6.8 新安装系统的网络IP配置(转载)
- 关于lunix系统下的centos7 系统配置SecureCRT时网络ip配置连接不上
- CentOS 6.8 新安装系统的网络IP配置(转载)
- CentOS 6.6 新安装系统的网络IP配置
- CentOS 6.6 新安装系统的网络IP配置
- 虚拟机下克隆3个centos系统并配置IP访问网络(转载)
- CentOS 6.7 新安装系统的网络IP配置
- CentOS 6.8 新安装系统的网络IP配置(转载)
- CentOS 6.6 新安装系统的网络IP配置
- CentOS 6.6 新安装系统的网络IP配置
- CentOS 6.6 新安装系统的网络IP配置
- CentOS 6.8新安装系统的网络IP配置
- 系统启动不了的情况下用PE查看网络IP配置信息(Windows系列系统)
- 虚拟机下克隆3个centos系统并配置IP访问网络
- CentOS 6.8 新安装系统的网络IP配置(转载)
- Linux-----系统安装【三】【配置ip等网络信息】
- centos 网络配置 修改IP,网关,DNS
- CentOS 6系统kvm虚拟机中配置桥接网络
- Linux网络管理员手册(5) 第五章 配置TCP/IP网络 proc文件系统 设置主机名 分配IP地址 IP的接口配置 以太网接口
- 初识运维4--Linux发行版系统(CentOS)的网络配置、远程连接和基本操作