bitkeeper revision 1.1159.223.53 (41fc0c19tGe1rM62SUQk8WYZjH-D1Q)

Add iptables modules to the default xen0 kernel, and add example configuration files for a NAT setup.
This commit is contained in:
iap10@labyrinth.cl.cam.ac.uk committed 2005-01-29 22:20:09 +00:00
1 parent 161acb14dd
commit 744d0bbffb
5 files changed
+278 -3

No files matched your search

+66
View File
@@ -0,0 +1,66 @@
#!/bin/sh
#============================================================================
# /etc/xen/vif-nat
#
# Script for configuring a vif in routed-nat mode.
# Xend calls a vif script when bringing a vif up or down.
# This script is the default - but it can be configured for each vif.
#
# Example invocation:
#
# vif-nat up domain=VM1 vif=vif1.0 ip="192.168.0.10/31"
#
# Usage:
# vif-nat (up|down) {VAR=VAL}*
#
# Vars:
#
# domain name of the domain the interface is on (required).
# vif vif interface name (required).
# ip list of IP networks for the vif, space-separated (required).
#============================================================================
# Exit if anything goes wrong
set -e
echo "vif-nat $*"
# Operation name.
OP=$1
shift
# Pull variables in args into environment
for arg ; do export "${arg}" ; done
# Required parameters. Fail if not set.
domain=${domain:?}
vif=${vif:?}
ip=${ip:?}
# better way to strip /netmask from the ip?
vif_ip=`echo ${ip} | awk -F. '{print $1"."$2"."$3"."$4}'`
main_ip=`ifconfig eth0 | grep "inet addr:" | sed -e 's/.*inet addr:\(\w\w*\.\w\w*\.\w\w*\.\w\w*\).*/\1/'`
# Are we going up or down?
case $OP in
up)
ifconfig ${vif} ${vif_ip} netmask 255.255.255.0 up
echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp
iptcmd='-A'
ipcmd='a'
;;
down)
ifconfig ${vif} down
iptcmd='-D'
ipcmd='d'
;;
*)
echo 'Invalid command: ' $OP
echo 'Valid commands are: up, down'
exit 1
;;
esac
ip r ${ipcmd} ${ip} dev ${vif} src ${main_ip}
# iptables ${iptcmd} FORWARD -m physdev --physdev-in ${vif} -p udp --sport 68 --dport 67 -j ACCEPT
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.