Masato Taruishi
taru****@users*****
2004年 10月 19日 (火) 19:57:35 JST
=================================================================== RCS file: demo/uml/map,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- demo/uml/map 2004/10/19 09:35:23 1.14 +++ demo/uml/map 2004/10/19 10:57:35 1.15 @@ -18,7 +18,8 @@ set -e WIDTH=8 -NETMASK=29 +NETMASKBIT=29 +NETMASK=255.255.255.252 NETPREFIX=192.168.1 if test "x$1" = "x"; then @@ -85,6 +86,13 @@ fi fi +net="$NETPREFIX.$n/$NETMASKBIT" +bcast="$NETPREFIX.`expr $n + $WIDTH - 1`" +netmask="$NETMASK" +host="$NETPREFIX.`expr $n + 1`" +uml="$NETPREFIX.`expr $n + 2`" +nat="true" + if test -f "$UML_CONFDIR/$arg/map.cf"; then . $UML_CONFDIR/$arg/map.cf fi @@ -93,10 +101,11 @@ suggests=$(echo $suggests | tr ' ' '\n' | sort | uniq | tr '\n' ' ') -echo "net=$NETPREFIX.$n/$NETMASK" -echo "bcast=$NETPREFIX.`expr $n + $WIDTH - 1`" -echo "host=$NETPREFIX.`expr $n + 1`" -echo "uml=$NETPREFIX.`expr $n + 2`" +echo "net=$net" +echo "bcast=$bcast" +echo "netmask=$netmask" +echo "host=$host" +echo "uml=$uml" echo "host_if=tap$id" echo "local_gateway=$local_gateway" echo "local_net=$UML_LOCALNETPREFIX.$id" =================================================================== RCS file: demo/uml/map.cf,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- demo/uml/map.cf 2004/10/19 03:31:21 1.2 +++ demo/uml/map.cf 2004/10/19 10:57:35 1.3 @@ -3,6 +3,9 @@ ## Network between host and uml such as 192.168.1.0/24 #net="" +## Netmask between host and uml such as 255.255.255.0 +#netmask="" + ## Broadcast address between host and uml #bcast="" @@ -11,6 +14,9 @@ ## UML IP address #uml="" + +## Use NAT +#nat="" ## Network Inteface on host for uml such as tap0 #host_if="" =================================================================== RCS file: demo/uml/uml-run,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- demo/uml/uml-run 2004/10/19 03:33:28 1.6 +++ demo/uml/uml-run 2004/10/19 10:57:35 1.7 @@ -33,8 +33,14 @@ trap "if test "x$pid" != "x"; then kill $pid; fi; eval `ultrapossum-config term`; tunctl -d $host_if; iptables -t nat -D POSTROUTING -s $net -d ! $net -j MASQUERADE" 0 tunctl -u $UML_USER -t $host_if -ifconfig $host_if $host broadcast $bcast netmask 255.255.255.252 up -iptables -t nat -A POSTROUTING -s $net -d ! $net -j MASQUERADE +ifconfig $host_if $host broadcast $bcast netmask $netmask up +route add -host $uml dev $host_if +if test "x$nat" != "x"; then + iptables -t nat -A POSTROUTING -s $net -d ! $net -j MASQUERADE +else + echo 1 > "/proc/sys/net/ipv4/conf/$host_if/proxy_arp" + arp -Ds $uml +fi echo 1 > /proc/sys/net/ipv4/ip_forward if ! "$@"; then