Score:0

route two interfaces that has ip of two different subnet

us flag

Yes I know it's a duplicate of many questions but I can't find my solution to them. I have a host virtual machine (ubuntu 16.04) that has two network adapters. one of them is connected to the gateway(so it has internet). but another one is just connected to the same port group as the first one. so diagram is something like that:

ubuntu ---
         |
         | ens160(136._.222) ---gateway(136._.209)---> internet
         | ens192(148._.177) ----->

So the question is, How can route all requests from subnet ens192 to the internet?

UPDATE: I enabled IP forwarding with this line:

sysctl -w net.ipv4.ip_forward=1

and set route like this:

ip route add 148._.176/29 via 136._.209 dev ens160

or

ip route add 148._.176/29 via 136._.222 dev ens160

but I get this message: RTNETLINK answers:FILE EXIST

Hassan Yousefzadeh avatar
us flag
port group on VMWare ESXi. you can define a virtual switch and connect some IPs virtually. A little about routing. what I want to do is for them to connect to the internet that is on the gateway ****209.
Tom Yan avatar
in flag
You don't need additional route for different sources on the forwarding host. Rather you need that on the "gateway" for the replying traffic to get to those sources (with the forwarding host as the nexthop/gateway).
Hassan Yousefzadeh avatar
us flag
I guess you don't get my mean .I need to route another NIC to that one that has internet
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.