# Routing containers through a different gateway

**URL:** <https://forums.suse.com/t/routing-containers-through-a-different-gateway/6989>\
**Category:** Rancher 1.x\
**Created:** [July 31, 2017, 2:30pm UTC](https://forums.suse.com/t/routing-containers-through-a-different-gateway/6989 "2017-07-31T14:30:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xeryax](https://avatars.discourse-cdn.com/v4/letter/x/49beb7/32.png) [@Xeryax](https://forums.suse.com/u/Xeryax)\
**Post date:** [July 31, 2017, 2:30pm UTC](https://forums.suse.com/t/routing-containers-through-a-different-gateway/6989/1 "2017-07-31T14:30:58Z")

</div>

I am really having a tough time figuring out how to route a container (or a group of containers) through a different gateway.  
My network is set up that I want the rancher server to route through x.x.x.1 for most traffic, but some containers will need to route through x.x.x.254.

1: is there a way to do this at the container setup level… (i.e. adjust the bridge or management network to use .254 as the gateway)  
2: is there a way to put custom persistent iptables rules on my Rancher host such that I can manually route the container through the correct gateway?

Anyone have this mystery figured out already?

---

<div class="post-metadata">

**Author:** ![leodotcloud](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/leodotcloud/32/3103_2.png) [@leodotcloud](https://forums.suse.com/u/leodotcloud)\
**Post date:** [November 6, 2017, 6:02pm UTC](https://forums.suse.com/t/routing-containers-through-a-different-gateway/6989/2 "2017-11-06T18:02:22Z")

</div>

Did you try configuring the custom routes on the host directly? Rancher takes care of routing only between containers on `10.42.0.0/16` network.
