Created
May 9, 2012 17:07
-
-
Save cadar/2646777 to your computer and use it in GitHub Desktop.
NAT on Dell Desktop running smartos kvm (one nic: e1000g0)
This file contains 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
DELL OPTIPLEX (one nic) | |
dladm show-phys -m | |
LINK SLOT ADDRESS INUSE CLIENT | |
e1000g0 primary d4:be:d9:99:ea:16 yes e1000g0 | |
ifconfig net0 unplumb | |
ifconfig net0 plumb | |
ifconfig net0 192.168.0.1/24 up | |
dladm delete-vnic net0 | |
dladm create-vnic -l e1000g0 net0 | |
dladm show-vnic | |
LINK OVER SPEED MACADDRESS MACADDRTYPE VID ZONE | |
net0 e1000g0 1000 2:8:20:34:d4:a8 random 0 -- | |
dladm show-link | |
LINK CLASS MTU STATE BRIDGE OVER | |
e1000g0 phys 1500 up -- -- | |
net0 vnic 1500 up -- e1000g0 | |
routeadm -u -e ipv4-forwarding | |
cat > /etc/ipf/ipnat.conf<<EOF | |
map bnx0 192.168.0.0/24 -> 0/32 portmap tcp/udp auto | |
map bnx0 192.168.0.0/24 -> 0/32 | |
EOF | |
svcadm disable network/ipfilter | |
svcadm enable network/ipfilter | |
time vmadm create <<EOF | |
{ "brand": "kvm", | |
"alias": "vdebian1", | |
"autoboot": false, | |
"vcpus": 2, | |
"ram": 512, | |
"disks": [{ | |
"boot": true, | |
"image_uuid": "debian1", | |
"model": "virtio", | |
"size": 40960 | |
}], | |
"default_gateway": "192.168.0.1", | |
"resolvers": [ "10.17.42.3", "8.8.8.8" ], | |
"nics": [{ | |
"nic_tag": "external", | |
"model": "virtio", | |
"ip":"192.168.0.2", | |
"netmask": "255.255.254.0", | |
"gateway": "192.168.0.1", | |
"primary": true | |
}] | |
} | |
EOF | |
vmadm list | |
export ID=`vmadm list|grep vdebian1|cut -b-36` ;echo $ID | |
tail -F /zones/$ID/root/tmp/vm.log & | |
time vmadm boot $ID | |
vmadm info $ID vnc | |
dladm reset-linkprop -z $ID -p protection net0 | |
dladm show-linkprop -z $ID | |
ssh root@192.168.0.2 | |
ifconfig -a | |
netstat -rn | |
apt-get update | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment