Skip to content

Instantly share code, notes, and snippets.

Created May 8, 2012 20:36
Show Gist options
  • Save cadar/2639064 to your computer and use it in GitHub Desktop.
Save cadar/2639064 to your computer and use it in GitHub Desktop.
make nat work with kvm running debian, raw file, I will redo this tomorrow and make sure nothing unnecessary is here
vmadm list
# remove your previous try
export ID=`vmadm list|grep run|cut -b-36` ; echo $ID
export ID=`vmadm list|grep stop|cut -b-36` ; echo $ID
vmadm stop $ID
vmadm destroy $ID
dladm show-phys -m
dladm show-link
dladm show-vnic
ifconfig -a
dladm create-vnic -l vswitch0 vnic6
dladm create-vnic -l vswitch0 net0
dladm create-vnic -l e1000g0 net0
dladm show-vnic
ifconfig vnic6 unplumb
ifconfig net0 unplumb
dladm delete-vnic vnic6
dladm delete-vnic net0
dladm show-vnic
netstat -rn
ifconfig -a
ifconfig vnic6 plumb
ifconfig net0 plumb
ifconfig vnic6 up
ifconfig net0 up
netstat -rn
vmadm list
vmadm create <<EOF
{ "brand": "kvm",
"alias": "debian1",
"autoboot": false,
"vcpus": 2,
"ram": 1024,
"disks": [{
"boot": true,
"image_uuid": "debian1",
"model": "virtio",
"size": 40960
"default_gateway": "",
"resolvers": [ "", "" ],
"nics": [{
"nic_tag": "external",
"model": "e1000",
"netmask": "",
"gateway": "",
"primary": true
export ID=`vmadm list|grep debian|cut -b-36` ;echo $ID
tail -F /zones/$ID/root/tmp/vm.log &
vmadm boot $ID
vmadm list
dladm reset-linkprop -z $ID -p protection net0
dladm show-linkprop -z $ID
dladm show-phys -m
dladm show-vnic
dladm show-link
netstat -rn
ping -s 156 3
ipnat -l
vmadm info $ID vnc
ssh root@
routeadm -u -e ipv4-forwarding
routeadm -u -e ipv4-routing
svcadm enable network/ipfilter
cat > /etc/ipf/ipnat.conf<<EOF
map e1000g0 -> 0/32 portmap tcp/udp auto
map e1000g0 -> 0/32
cat /etc/ipf/ipnat.conf
svcadm disable network/ipfilter
svcadm enable network/ipfilter
ipnat -l
netstat -rn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment