Skip to content

Instantly share code, notes, and snippets.

@JohnArchieMckown
Last active August 29, 2015 14:05
Show Gist options
  • Save JohnArchieMckown/34b00c10fea0cb8f626b to your computer and use it in GitHub Desktop.
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
#!/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
#!/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 ""
#UUID="d735249a-1305-4a53-a462-4e1319becaef"
NM_CONTROLLED="yes"
HWADDR="56:61:4f:7c:77:db"
BOOTPROTO="dhcp"
DEVICE="mac1"
ONBOOT="no"
#!/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