Force routing between three hosts


 
Thread Tools Search this Thread
Special Forums IP Networking Force routing between three hosts
# 1  
Old 07-22-2014
Question Force routing between three hosts

Hi,
I'm having problem trying to create the following scenario: VM1 <--> VM2 <--> VM3

where VM1, VM2 and VM3 are virtual machines and VM1 and VM3 have to pass trough VM2 to "talk" each other.

The best solution should be change the default gateway of VM1 and VM3 by pointing it to VM2 IP address.


For this reason, I've tried to add a new default gateway (route add default gw <VM2_IP>) and then I tried to delete the old default gateway but it is not working.

I've also tried to add a new route for VM3 in VM1:
route add -host <IP_VM3> gw <IP_VM2>
but in this case the VM3 is unreachable from VM1.

How can I do it?
Is there any specific procedure since they are VMs and not physical machine?

Thanks,
Massimo
# 2  
Old 07-23-2014
Hi

You need use iptables to DNAT all outgoing traffic
# 3  
Old 07-23-2014
HI,
thanks for your answer.
I'm not sure if I get your hint.

Did you suggest me to use DNAT on VM1 and VM3?

In particular, you suggest me to do this on VM1:
iptables -t nat -A PREROUTING -i eth0 -j DNAT --to <IP_VM2>

Is it right?

Just to be sure, what I want is to send a packet from VM1 to VM3, but this packet
have to pass through VM2.

Should I do something in VM2,like enable IP forwarding?

Sorry for these (maybe) newbie question.

Thanks,
M
# 4  
Old 07-23-2014
posted a wrong type of answer, please delete this message
# 5  
Old 07-24-2014
Any idea about this?
M
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to copy a tar file on a series of remote hosts and untar it on those hosts?

Am trying to copy a tar file onto a series of remote hosts and untar it at the destination. Need to do this without having to do multiple ssh. Actions to perform within a single ssh session via shell script - copy a file - untar at destination (remote host) OS : Linux RHEL6 (3 Replies)
Discussion started by: sankasu
3 Replies

2. Red Hat

Force ssl/ssh to use the hosts file

does anyone know how to force ssh/ssl to use the hosts file instead of DNS? I have disabled the DNS servers but ssh still will not resolve a host in the hosts file. thanks in advance for the help! DS (3 Replies)
Discussion started by: derrell simpson
3 Replies

3. AIX

aix tcp wrappers hosts.allow hosts.deny?

hi all just installed the netsec.options.tcpwrapper from expansion pack, which used to be a rpm, for my aix 6.1 test box. it is so unpredictable. i set up the hosts.deny as suggested for all and allow the sshd for specific ip addresses/hostnames. the tcpdchk says the hosts allowed and... (0 Replies)
Discussion started by: wf201626
0 Replies

4. Shell Programming and Scripting

perl - force matching

for below perl code, if without ?, will print test, otherwise will print null. i know it is due to greedy perl regexp matching that eat out test by previous .*, i also know there should be a way to force perl to match if can match, can anyone help me to figure it out or lead me to the right... (6 Replies)
Discussion started by: summer_cherry
6 Replies

5. Red Hat

Force machine reconfiguration

Hi, This may be a dumb question, but here goes. While I have been using Linux for some time, I am wondering if a certain capability exists within Red Hat that I have found within SUSE. Cool stuff you might not know that AutoYast can do ? Part 1 Linux In Novell’s East Region points to... (0 Replies)
Discussion started by: mark54g
0 Replies

6. HP-UX

Is it really impossible to force umount on HP-UX

Hello, yeah... here my question : Exist some way to force umount on HP other than reboot? Thanks gb (12 Replies)
Discussion started by: gogol_bordello
12 Replies

7. HP-UX

how to force umount

sorry, wrong section, mod please close thread (0 Replies)
Discussion started by: robertngo
0 Replies

8. UNIX for Dummies Questions & Answers

Hosts.allow and hosts.deny

Hello everyone, This is my first posts and I did search for a questions but did not find a question that answered my question unless of course I overlooked it. I'm running Solaris 8. I use ssh for the users but I have a user called "chatterbox" that uses telnet but I need for chatterbox to... (1 Reply)
Discussion started by: huddlestonsnk
1 Replies

9. Linux

Is there any way to unload *.so by force?

In linux, dlclose can unload the dynamic linked library when the reference count decreases to zero. My questions is: Is there any way to unload the *.so without caring the reference count? (0 Replies)
Discussion started by: princelinux
0 Replies

10. UNIX for Dummies Questions & Answers

hosts.allow & hosts.deny

Hi! Im trying to use host.allow & host.deny to resrtic access to my sun machine, but it doesnt seem to work... I want to allow full access from certain IPīs (ssh,http,ftp,etc...) but deny all kind of conections from outsideworld, the way that im doing that is: hosts.allow ALL:127.0.0.1... (2 Replies)
Discussion started by: Sorrento
2 Replies
Login or Register to Ask a Question