Created
May 9, 2012 17:04
-
-
Save cadar/2646755 to your computer and use it in GitHub Desktop.
NAT on Dell PowerEdge M610 Blade Server (two nics: bnx0) running SmartOS kvm
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
Dell PowerEdge M610 Blade Server (two nics) | |
DELL-PERC H700 | |
dladm show-phys -m | |
LINK SLOT ADDRESS INUSE CLIENT | |
bnx0 primary 24:b6:fd:d5:f:cf yes bnx0 | |
bnx1 primary 24:b6:fd:d5:f:d1 no -- | |
ifconfig net0 unplumb | |
ifconfig net0 plumb | |
ifconfig net0 192.168.0.1/24 up metric 3 | |
ifconfig net1 unplumb | |
ifconfig net1 plumb | |
ifconfig net1 192.168.1.1/24 up metric 1 | |
dladm delete-vnic net0 | |
dladm delete-vnic net1 | |
dladm create-vnic -l bnx0 net0 | |
dladm create-vnic -l bnx1 net1 | |
dladm show-vnic | |
LINK OVER SPEED MACADDRESS MACADDRTYPE VID ZONE | |
net0 bnx0 1000 2:8:20:7c:16:d8 random 0 -- | |
dladm show-link | |
LINK CLASS MTU STATE BRIDGE OVER | |
bnx0 phys 1500 up -- -- | |
bnx1 phys 1500 unknown -- -- | |
net0 vnic 1500 up -- bnx0 | |
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": "admin", | |
"model": "virtio", | |
"ip":"192.168.0.2", | |
"netmask": "255.255.255.0", | |
"gateway": "192.168.0.1", | |
"primary": true | |
},{ | |
"nic_tag": "external", | |
"model": "virtio", | |
"ip":"192.168.0.3", | |
"netmask": "255.255.255.0", | |
"gateway": "192.168.0.1" | |
}] | |
} | |
EOF | |
vmadm list | |
export ID=`vmadm list|grep vdebian1|cut -b-36` ;echo $ID | |
tail -F /zones/$ID/root/tmp/vm.log & | |
vmadm boot $ID | |
dladm reset-linkprop -z $ID -p protection net0 | |
dladm reset-linkprop -z $ID -p protection net1 | |
dladm show-linkprop -z $ID | |
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 | |
ssh [email protected] | |
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