双网卡绑定
# cd /etc/sysconfig/network-scripts/
#vi ifcfg-bond0 (默认无此文件,需添加)
DEVICE=bond0
IPADDR=192.168.1.5
NETMASK=255.255.255.255
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
ONBOOT=yes
BOOTPROTO=none dhcp、静态、绑定
USERCTL=no 是否允许非root用户控制
IPADDR=192.168.1.5
NETMASK=255.255.255.255
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
ONBOOT=yes
BOOTPROTO=none dhcp、静态、绑定
USERCTL=no 是否允许非root用户控制
#vi ifcfg-eth0
DEVICE=eth0
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
#vi ifcfg-eth1
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
/f 添加两行
alias bond0 bonding系统在启动时加载bonding模块,对外虚拟网络接口设备为 bond0
options bond0 miimon=100 mode=1
options bond0 miimon=100 mode=1
service network restart 重启服务生效
测试
cat /proc/net/bonding/bond0
VI编辑器
:set nu 显示行 :set nonu取消
dd删除当前行 yy复制当前行
:2,3 y 复制2-3行 p粘贴
u 撤销上一步的操作
Ctrl+r 恢复上一步被撤销的操作
Ctrl+r 恢复上一步被撤销的操作
DHCP构建
rpm -qa | grep dhcp 列出所有被安装的rpm package
安装光盘里的服务
[root@localhost ~]# cd /media/
[root@localhost media]# ls
RHEL_5.5 i386 DVD
[root@localhost media]# cd RHEL_5.5\ i386\ DVD/
[root@localhost media]# ls
RHEL_5.5 i386 DVD
[root@localhost media]# cd RHEL_5.5\ i386\ DVD/
[root@localhost RHEL_5.5 i386 DVD]# find -name dhcp*
./Server/dhcp-3.0.5-23.el5.i386.rpm
./Server/dhcp-devel-3.0.5-23.el5.i386.rpm
./Server/dhcpv6-1.0.10-18.el5.i386.rpm
./Server/dhcpv6-client-1.0.10-18.el5.i386.rpm
[root@localhost RHEL_5.5 i386 DVD]# rpm -ivh ./Server/dhcp-3.0.5-23.el5.i386.rpm 安装当前目录下rpm软件包
warning: ./Server/dhcp-3.0.5-23.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
>>>>>>>>### [100%] 1:dhcp >>>>>>>>### [100%][root@localhost RHEL_5.5 i386 DVD]#
./Server/dhcp-3.0.5-23.el5.i386.rpm
./Server/dhcp-devel-3.0.5-23.el5.i386.rpm
./Server/dhcpv6-1.0.10-18.el5.i386.rpm
./Server/dhcpv6-client-1.0.10-18.el5.i386.rpm
[root@localhost RHEL_5.5 i386 DVD]# rpm -ivh ./Server/dhcp-3.0.5-23.el5.i386.rpm 安装当前目录下rpm软件包
warning: ./Server/dhcp-3.0.5-23.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
>>>>>>>>### [100%] 1:dhcp >>>>>>>>### [100%][root@localhost RHEL_5.5 i386 DVD]#
编辑DHCP服务配置
vi /f(若无此文件,添加,或复制cp /etc/share/doc/dhcp-3.0.f.sample)
主[root@localhost ~]# cat /f
default-lease-time 259200;
max-lease-time 518400;
authoritative; 拒绝不正确的IP地址的要求
ddns-update-style interim;
ignore client-updates;
option acip code 43 = string;定义option43
one-lease-per-client true;
failover peer "dhcp" {
primary;
address 192.168.0.53;
default-lease-time 259200;
max-lease-time 518400;
authoritative; 拒绝不正确的IP地址的要求
ddns-update-style interim;
ignore client-updates;
option acip code 43 = string;定义option43
one-lease-per-client true;
failover peer "dhcp" {
primary;
address 192.168.0.53;
port 520;
peer address 192.168.0.52;
peer port 519;
max-response-delay 300;
max-unacked-updates 10;
mclt 600;
split 128;
load balance max seconds 3;
}
shared-network chaojiyu{ 若无需配置超级域名,此行略去
peer address 192.168.0.52;
peer port 519;
max-response-delay 300;
max-unacked-updates 10;
mclt 600;
split 128;
load balance max seconds 3;
}
shared-network chaojiyu{ 若无需配置超级域名,此行略去
subnet 192.168.0.48 netmask 255.255.255.240 {
option routers 192.168.0.49;
option subnet-mask 255.255.255.240;
option acip 80:07:00:00:01:C0:A8:91:75;
pool {
option routers 192.168.0.49;
option subnet-mask 255.255.255.240;
option acip 80:07:00:00:01:C0:A8:91:75;
pool {
failover peer "dhcp";
range 192.168.0.58 192.168.0.59;
deny dynamic bootp clients;
}
}
range 192.168.0.58 192.168.0.59;
deny dynamic bootp clients;
}
}
} 若无需配置超级域名,此行略去
备[root@localhost ~]# cat /f
default-lease-time 259200;
max-lease-time 518400;
authoritative;
ddns-update-style interim;
ignore client-updates;
option acip code 43 = string;
default-lease-time 259200;
max-lease-time 518400;
authoritative;
ddns-update-style interim;
ignore client-updates;
option acip code 43 = string;
one-lease-per-client true;
failover peer "dhcp" {
secondary;
address 192.168.0.52;
port 519;
peer address 192.168.0.53;
peer port 520;
max-response-delay 300;
免费永久的linux服务器 max-unacked-updates 10;
}
shared-network chaojiyu{ 若无需配置超级域名,此行略去
failover peer "dhcp" {
secondary;
address 192.168.0.52;
port 519;
peer address 192.168.0.53;
peer port 520;
max-response-delay 300;
免费永久的linux服务器 max-unacked-updates 10;
}
shared-network chaojiyu{ 若无需配置超级域名,此行略去
subnet 192.168.0.48 netmask 255.255.255.240 {
option routers 192.168.0.49;
option subnet-mask 255.255.255.240;
option acip 80:07:00:00:01:C0:A8:91:75;
option routers 192.168.0.49;
option subnet-mask 255.255.255.240;
option acip 80:07:00:00:01:C0:A8:91:75;
pool {
failover peer "dhcp";
range 192.168.0.58 192.168.0.59;
deny dynamic bootp clients;
}
}
failover peer "dhcp";
range 192.168.0.58 192.168.0.59;
deny dynamic bootp clients;
}
}
} 若无需配置超级域名,此行略去
应用到接口
vi /etc/sysconfig/dhcpd
DHCPDARGS=bond0(ls查看文件,没有则添加文件 touch /var/lib/dhcpd/dhcpd.leases)
service dhcpd restart 重启服务生效
cat /var/lib/dhcpd/dhcpd.leases 查看地址池分配情况,及数据同步状态
lease 192.168.1.255 { #DHCP服务器分配的IP地址#
starts 1 2005/05/02 03:02:26; # lease 开始租约时间#
ends 1 2005/05/02 09:02:26; # lease 结束租约时间#
binding state active;
next binding state free;
hardware ethernet 00:00:e8:a0:25:86; #客户机网卡MAC地址#
uid "\001\000\000\350\240%\206"; #用来验证客户机的UID标志#
client-hostname "cjh1"; #客户机名称#
starts 1 2005/05/02 03:02:26; # lease 开始租约时间#
ends 1 2005/05/02 09:02:26; # lease 结束租约时间#
binding state active;
next binding state free;
hardware ethernet 00:00:e8:a0:25:86; #客户机网卡MAC地址#
uid "\001\000\000\350\240%\206"; #用来验证客户机的UID标志#
client-hostname "cjh1"; #客户机名称#
}
检查dhcpd进程
[root@localhost ~]# ps -ef | grep dhcpd
root 1488 1 0 01:35 ? 00:00:00 /usr/sbin/dhcpd bond0
root 2340 2284 0 03:21 pts/1 00:00:00 grep dhcpd
root 1488 1 0 01:35 ? 00:00:00 /usr/sbin/dhcpd bond0
root 2340 2284 0 03:21 pts/1 00:00:00 grep dhcpd
pstree|grep dhcpd 检验dhcpd是否被启动
返回结果应该为:|-dhcpd
[root@localhost ~]# netstat -nutap | grep dhcpd 检查dhcpd运行的端口
tcp 0 0 192.168.0.52:519 0.0.0.0:* LISTEN 1488/dhcpd
udp 0 0 0.0.0.0:67 0.0.0.0:* 1488/dhcpd
tcp 0 0 192.168.0.52:519 0.0.0.0:* LISTEN 1488/dhcpd
udp 0 0 0.0.0.0:67 0.0.0.0:* 1488/dhcpd
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论