two gateway two network interface card problem

tommy

Verified User
Joined
Oct 14, 2012
Messages
6
I input a new lan cable into my server. eth1

my server main ip is : 192.168.198.134~192.168.198.135 (useing eth0)

my server main gateway 192.168.198.1

I get a new IP(192.168.79.39) and new gateway(192.168.79.1)

so I had input a new lan cable to eth1 port (and is eth need use the new ip 192.168.79.39) , But I Use "/etc/init.d/startips start" show me 192.168.79.39 already exists on eth0.

I Use this script
Code:
IP1="192.168.1.10"   #interface IP
NM1="255.255.255.0"  #interface netmask
NW1="192.168.1.0"    #interface network address
PR1="24"         #interface prefix (based on netmask)
GW1="192.168.1.1"    #interface gateway
 
IP2="10.4.50.4"
NM2="255.0.0.0"
NW2="10.0.0.0"
PR2="8"
GW2="10.0.0.1"
 
#down the interfaces and wipe the existing config
ifconfig eth0 down
ifconfig eth1 down
 
#set ips
ifconfig eth0 up
ifconfig eth1 up
ifconfig eth0 $IP1 netmask $NM1
ifconfig eth1 $IP2 netmask $NM2
 
#add default gw
route add default gw $GW1 # set gw1 as system's default gw
 
#create tables
echo "102 WAN2" >> /etc/iproute2/rt_tables
echo "101 WAN1" >> /etc/iproute2/rt_tables
 
#iproute2 routing
ip route add $NW1/$PR1 dev eth0 src $IP1 table WAN1
ip route add default via $GW1 table WAN1
ip route add $NW1/$PR1 dev eth0 src $IP1
ip rule add from $IP1 table WAN1
#--
ip route add $NW2/$PR2 dev eth1 src $IP2 table WAN2
ip route add default via $GW2 table WAN2
ip route add $NW2/$PR2 dev eth1 src $IP2
ip rule add from $IP2 table WAN2
#--

Now the situation is I can ping is ip and very fast (2ms) But I use the same PC go to directadmin (192.168.79.39:da_port) very very slow .... and timeout.

Pls. How can I do ?
 
Back
Top