Andy Bavier | 0e8511f | 2016-03-01 13:13:42 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | IFACE=$1 |
| 4 | |
| 5 | # Assumes that mgmtbr is set up on 10.10.1.1 interface |
| 6 | apt-get install bridge-utils dnsmasq |
| 7 | brctl addbr mgmtbr |
| 8 | ifconfig $IFACE 0.0.0.0 |
| 9 | brctl addif mgmtbr $IFACE |
| 10 | ifconfig mgmtbr 10.10.1.1/24 up |
| 11 | |
| 12 | cat <<EOF > /etc/dnsmasq.d/cord |
| 13 | dhcp-range=10.10.1.3,10.10.1.253 |
| 14 | interface=mgmtbr |
| 15 | dhcp-option=option:router,10.10.1.1 |
| 16 | EOF |
| 17 | |
| 18 | service dnsmasq restart |
| 19 | |
| 20 | # Assumes eth0 is the public interface |
| 21 | iptables -t nat -I POSTROUTING -s 10.10.1.0/24 \! -d 10.10.1.0/24 -j MASQUERADE |