Skip to content

Instantly share code, notes, and snippets.

@darlzkrish27
Created January 25, 2019 12:33
Show Gist options
  • Select an option

  • Save darlzkrish27/5ee4bec489d4accfd5009dc4a24eae0c to your computer and use it in GitHub Desktop.

Select an option

Save darlzkrish27/5ee4bec489d4accfd5009dc4a24eae0c to your computer and use it in GitHub Desktop.
centos
runcmd:
- 'sudo touch /etc/sysconfig/network-scripts/ifcfg-eth1'
write_files:
- content: |
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=dhcp
DEFROUTE=no
PEERDNS=no
PEERROUTES=yes
path: /etc/sysconfig/network-scripts/ifcfg-eth1
runcmd:
- 'sudo tee -a /etc/iproute2/rt_tables <<< "1 eth1"'
- 'sudo ifup eth1'
- 'sudo ip rule add from 172.16.1.0/24 table eth1'
- 'sudo ip route add default via 172.16.1.1 dev eth1 table eth1'
- 'sudo chmod +x /etc/rc.d/rc.local'
- 'sudo tee -a /etc/rc.d/rc.local <<< "sudo ip rule add from 172.16.1.0/24 table eth1"'
- 'sudo tee -a /etc/rc.d/rc.local <<< "sudo ip route add default via 172.16.1.1 dev eth1 table eth1"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment