本帖最后由 xie525767270 于 2016-8-8 22:06 编辑
这是DIR网卡,eth0是外网,eth1是内网。
eth0 Link encap:Ethernet HWaddr 00:0C:29:0D:2A:BB
inet addr:192.168.137.200 Bcast:192.168.137.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe0d:2abb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3881 errors:0 dropped:0 overruns:0 frame:0
TX packets:3100 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:399597 (390.2 KiB) TX bytes:397254 (387.9 KiB)
Interrupt:19 Base address:0x2000
eth1 Link encap:Ethernet HWaddr 00:0C:29:0D:2A:C5
inet addr:192.168.1.202 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe0d:2ac5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1556 errors:0 dropped:0 overruns:0 frame:0
TX packets:778 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:118096 (115.3 KiB) TX bytes:76947 (75.1 KiB)
Interrupt:19 Base address:0x2080
这是dir上的脚本,这上面的eth0,eth1我对换了位置 这样对吗
#! /bin/bash
# director 服务器上开启路由转发功能:
echo 0 > /proc/sys/net/ipv4/ip_forward
# 关闭icmp的重定向
echo 1 > /proc/sys/net/ipv4/conf/all/send_redirects
echo 1 > /proc/sys/net/ipv4/conf/default/send_redirects
echo 1 > /proc/sys/net/ipv4/conf/eth1/send_redirects
echo 1 > /proc/sys/net/ipv4/conf/eth0/send_redirects
# director 设置nat防火墙
iptables -t nat -F
iptables -t nat -X
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
# director设置ipvsadm
IPVSADM='/sbin/ipvsadm'
$IPVSADM -C
$IPVSADM -A -t 192.168.137.200:80 -s rr
$IPVSADM -a -t 192.168.137.200:80 -r 192.168.1.200:80 -m
$IPVSADM -a -t 192.168.137.200:80 -r 192.168.1.201:80 -m
[root@dir ~]# curl 192.168.137.200
curl: (7) couldn't connect to host
视频下面的问题也详细看了,也没有一个能解决问题的,外网的网卡UUID 和HWADDR也都注释了。就不知道是不是eth0和eth1顺序弄错了。。。请教各位大神,对了 ,按照阿铭老师脚本样板上的书写顺序也是不行,不知道哪儿出了问题。
这是DIR网卡,eth0是外网,eth1是内网。
eth0 Link encap:Ethernet HWaddr 00:0C:29:0D:2A:BB
inet addr:192.168.137.200 Bcast:192.168.137.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe0d:2abb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3881 errors:0 dropped:0 overruns:0 frame:0
TX packets:3100 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:399597 (390.2 KiB) TX bytes:397254 (387.9 KiB)
Interrupt:19 Base address:0x2000
eth1 Link encap:Ethernet HWaddr 00:0C:29:0D:2A:C5
inet addr:192.168.1.202 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe0d:2ac5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1556 errors:0 dropped:0 overruns:0 frame:0
TX packets:778 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:118096 (115.3 KiB) TX bytes:76947 (75.1 KiB)
Interrupt:19 Base address:0x2080
这是dir上的脚本,这上面的eth0,eth1我对换了位置 这样对吗
#! /bin/bash
# director 服务器上开启路由转发功能:
echo 0 > /proc/sys/net/ipv4/ip_forward
# 关闭icmp的重定向
echo 1 > /proc/sys/net/ipv4/conf/all/send_redirects
echo 1 > /proc/sys/net/ipv4/conf/default/send_redirects
echo 1 > /proc/sys/net/ipv4/conf/eth1/send_redirects
echo 1 > /proc/sys/net/ipv4/conf/eth0/send_redirects
# director 设置nat防火墙
iptables -t nat -F
iptables -t nat -X
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
# director设置ipvsadm
IPVSADM='/sbin/ipvsadm'
$IPVSADM -C
$IPVSADM -A -t 192.168.137.200:80 -s rr
$IPVSADM -a -t 192.168.137.200:80 -r 192.168.1.200:80 -m
$IPVSADM -a -t 192.168.137.200:80 -r 192.168.1.201:80 -m
[root@dir ~]# curl 192.168.137.200
curl: (7) couldn't connect to host
视频下面的问题也详细看了,也没有一个能解决问题的,外网的网卡UUID 和HWADDR也都注释了。就不知道是不是eth0和eth1顺序弄错了。。。请教各位大神,对了 ,按照阿铭老师脚本样板上的书写顺序也是不行,不知道哪儿出了问题。
编辑回复