Question: routing packets via specific router in LAN?

2 messages, 2 authors, 2012-09-03 · open the first message on its own page

Question: routing packets via specific router in LAN?

From: Yi Li <hidden>
Date: 2012-09-03 06:04:52

Hi All,
I have server --- router ---client three machines,
and they all have only one ip in the same LAN.
I want to instruct the packets flowing through the router when the
server and client communicates.
I have do the following things to setup:
on the server:
# ip route add to unicast CLIENT_IP/32 via ROUTER_IP dev eth0
# echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
# echo 0 > /proc/sys/net/ipv4/conf/eth0/accept_redirects

on the client:
/*modify route table*/
# ip route add to unicast SERVER_IP/32 via ROUTER_IP dev eth0
/*disable icmp-redirects accept*/
# echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
# echo 0 > /proc/sys/net/ipv4/conf/eth0/accept_redirects

on the router:
/*enable forwarding*/
# echo 1 > /proc/sys/net/ipv4/ip_forwarding
/*disable icmp-redirects*/
# echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects
# echo 0 > /proc/sys/net/ipv4/conf/eth0/send_redirects

BTW, I have disabled iptables on all of these three machines.

But I still can't tcpdump any packets on the router which means no
packets flowing
through the router. The server and client communicates by pass the router!

So, What I have missed, or we can't setup server-router-client topo in LAN?
Thanks in advaced.

Re: Question: routing packets via specific router in LAN?

From: Cong Wang <hidden>
Date: 2012-09-03 08:28:48

On Mon, 03 Sep 2012 at 06:04 GMT, Yi Li [off-list ref] wrote:
Hi All,
I have server --- router ---client three machines,
and they all have only one ip in the same LAN.
I want to instruct the packets flowing through the router when the
server and client communicates.
I have do the following things to setup:
on the server:
# ip route add to unicast CLIENT_IP/32 via ROUTER_IP dev eth0
# echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
# echo 0 > /proc/sys/net/ipv4/conf/eth0/accept_redirects

on the client:
/*modify route table*/
# ip route add to unicast SERVER_IP/32 via ROUTER_IP dev eth0
/*disable icmp-redirects accept*/
# echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
# echo 0 > /proc/sys/net/ipv4/conf/eth0/accept_redirects

on the router:
/*enable forwarding*/
# echo 1 > /proc/sys/net/ipv4/ip_forwarding
/*disable icmp-redirects*/
# echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects
# echo 0 > /proc/sys/net/ipv4/conf/eth0/send_redirects
Try to add some iptables rules like:

iptables -A FORWARD -j ACCEPT -s CLIENT_IP/xx -d  SERVER_IP/xx
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help