[openbeos] Help to share network with Qemu on Linux

Hi,

I had to search for this information and hope it can help some people :

1/ Create a file /etc/qemu-ifup :

   #!/bin/sh
   sudo modprobe tun
   sudo /sbin/ifconfig $1 up 10.0.2.2 netmask 255.255.255.0 broadcast
10.0.2.255

   # IP masquerade
   sudo echo "1" > /proc/sys/net/ipv4/ip_forward
   sudo /sbin/iptables -N nat
   sudo /sbin/iptables -t nat -F
   sudo /sbin/iptables -t nat -A POSTROUTING -s 10.0.2.15 -j MASQUERADE
   sudo /sbin/iptables -t nat -A POSTROUTING -d 10.0.2.15 -o $1

2/ chmod 755 /etc/qemu-ifup

3/ Launch qemu :

qemu -hda generated/haiku.image  -serial stdio -usb -soundhw all -net
nic -net user

Bye,
Jérôme

Other related posts: