# Network config with routes before bringing eth0 up

**URL:** <https://forums.suse.com/t/network-config-with-routes-before-bringing-eth0-up/5588>\
**Category:** RancherOS\
**Created:** [February 20, 2017, 12:33am UTC](https://forums.suse.com/t/network-config-with-routes-before-bringing-eth0-up/5588 "2017-02-20T00:33:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefan\_Bogdan\_Cimpea](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Stefan\_Bogdan\_Cimpea](https://forums.suse.com/u/Stefan_Bogdan_Cimpea)\
**Post date:** [February 20, 2017, 12:33am UTC](https://forums.suse.com/t/network-config-with-routes-before-bringing-eth0-up/5588/1 "2017-02-20T00:33:29Z")

</div>

Hello all,  
I my current setup, it’s required that I set IP address 1.2.3.4 with netmask /32 while gateway is 5.6.7.8 (completely different subnet).  
When booting from ISO, I can do  
`sudo route add 5.6.7.8 dev eth0 sudo ros config set rancher.network.interfaces.eth0.address 1.2.3.4/32 sudo ros config set rancher.network.interfaces.eth0.gateway 5.6.7.8 sudo ros config set rancher.network.interfaces.eth0.dhcp false sudo netconf`  
and I’d get networking.

How can I put this in a cloud-config.yml file please? Note that the route command needs to executed before bringing up/configuring networking.  
runcmd, bootcmd are not allowed for rancheros, also I can’t seem to be able to add any sort of user, or set a password to rancher user, in order to setup networking manually via console screen.

Thanks!

---

<div class="post-metadata">

**Author:** ![NarunasK](https://avatars.discourse-cdn.com/v4/letter/n/f07891/32.png) [@NarunasK](https://forums.suse.com/u/NarunasK)\
**Post date:** [February 20, 2017, 12:20pm UTC](https://forums.suse.com/t/network-config-with-routes-before-bringing-eth0-up/5588/2 "2017-02-20T12:20:12Z")

</div>

Have you tried something like:

```
#cloud-config

rancher:
  network:
    interfaces:
      eth0:
        address: 1.2.3.4/32
        gateway: 5.6.7.8
        mtu: 1500
        dhcp: false
      pre_up:
        - ip route add 5.6.7.8 dev eth0
```

---

<div class="post-metadata">

**Author:** ![SvenDowideit](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/svendowideit/32/2159_2.png) [@SvenDowideit](https://forums.suse.com/u/SvenDowideit)\
**Post date:** [February 22, 2017, 5:56pm UTC](https://forums.suse.com/t/network-config-with-routes-before-bringing-eth0-up/5588/3 "2017-02-22T17:56:19Z")

</div>

One really nice thing I use is that after making `ros config set` changes, you can find out what the `cloud-config.yml` file would look like by running `ros config export`.
