Last active
August 29, 2015 14:05
-
-
Save JohnArchieMckown/34b00c10fea0cb8f626b to your computer and use it in GitHub Desktop.
Help generate macvlan & support programs. Two default gateways on one NIC with 2 Internet routers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| ip link add link p36p1 mac1 address 56:61:4f:7c:77:db type macvlan | |
| # next line adds default route via the router connected to the cable modem | |
| ip route add default via 192.168.151.65 dev mac1 table mac1tbl # refers to /etc/iproute2/rt_tables entry | |
| ip rule add from 192.168.151.65/32 table mac1tbl | |
| ip rule add to 192.168.151.65/32 table mac1tbl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # -*- mode: python; -*- | |
| print "" | |
| print "New UUID:" | |
| import virtinst.util ; print virtinst.util.uuidToString(virtinst.util.randomUUID()) | |
| print "New MAC:" | |
| import virtinst.util ; print virtinst.util.randomMAC() | |
| print "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #UUID="d735249a-1305-4a53-a462-4e1319becaef" | |
| NM_CONTROLLED="yes" | |
| HWADDR="56:61:4f:7c:77:db" | |
| BOOTPROTO="dhcp" | |
| DEVICE="mac1" | |
| ONBOOT="no" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # macgen.py script to generate a MAC address for guests on Xen | |
| # | |
| import random | |
| # | |
| def randomMAC(): | |
| mac = [ 0x00, 0x16, 0x3e, | |
| random.randint(0x00, 0x7f), | |
| random.randint(0x00, 0xff), | |
| random.randint(0x00, 0xff) ] | |
| return ':'.join(map(lambda x: "%02x" % x, mac)) | |
| # | |
| print randomMAC() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment