正文
#OS基于Centos7,测试环境,生产环境根据实际情况修改
#安装路由软件
yum install quagga
#配置zebra
#cat /etc/quagga/zebra.conf
!
! Zebra configuration saved from vty
! 2017/09/28 15:57:12
!
hostname test-ssl-10-231.test.org #这个每台名字要不同
password 8 WuN0UOEsh./0U
enable password 8 g9UPXyneQv2n.
log file /var/log/quagga/zebra.log
service password-encryption
#配置ospfd
# cat /etc/quagga/ospfd.conf
hostname test-ssl-10-231.test.org #每台要不同
password 8 cQGHF4e9QbcA
enable password 8 RBUKMtvgMhU3M
log file /var/log/quagga/ospfd.log
service password-encryption
!
!
!
interface eth2
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 pIW87ypU3d4v3pG7 #此处密码告知网络工程师
ip ospf hello-interval 1
ip ospf dead-interval 4
ip ospf priority 0
router ospf
ospf router-id 10.10.41.130 #每台router-id要不一样
log-adjacency-changes
network 10.10.41.0/24 area 0.0.0.0
network 10.10.100.100/32 area 0.0.0.0 #宣告自己的ospf互边地址和VIP地址,新增地址都在此处添加
area 0.0.0.0 authentication message-digest
!
line vty
!
#启动服务
systemctl enable zebra.service
systemctl enable ospfd.service
systemctl start zebra.service
systemctl start ospfd.service
#添加ospf和zebra保活,打开配置文件打开如下行行
vim /etc/sysconfig/quagga
WATCH_DAEMONS="zebra ospfd"
######策略路由配置,eth0指向默认路由,在eth1模拟公网进行配置######
#cat /etc/iproute2/rt_tables增加
100 wan41
#增加路由表相关配置
ip route add 10.10.41.0/24 dev eth1 src 10.10.41.130 table wan41
ip route add default via 10.10.41.250 table wan41
ip rule add from 10.10.41.130 table wan41
持久化到配置文件
cat route-eth1
10.10.41.0/24 dev eth2 src 10.10.41.130 table wan41
default via 10.10.41.250 table 100
cat rule-eth1
from 10.10.41.130 table wan41
######策略路由配置结束######
server context listen增加如下:
listen 80 proxy_protocol;