in the “Configuring NAT…” example why isn’t there any case for status and restart
needs tech review. My bash is good but I can't be sure I could write the init script for this. Requesting engineering to write the rest of the init script.
Herbert, can you review this for Chris?
Sorry what exactly do I need to review? Could you attach it to this bug please? Thanks!
Configuring NAT for virtualized guests Network address translation (NAT) allows multiple network address to connect through a single IP address by intercepting packets and passing them to the private IP addresses. You can copy the following script to /etc/init.d/xenLaptopNAT and create a soft link to /etc/rc3.d/S99xenLaptopNAT. this automatically starts NAT at boot time. NetworkManager and wireless NAT The script below may not work well with wireless network or NetworkManager due to start up delays. In this case run the script manually once the machine has booted. #!/bin/bash PATH=/usr/bin:/sbin:/bin:/usr/sbin export PATH GATEWAYDEV=`ip route | grep default | awk {'print $5'}` iptables -F case "$1" in start) if test -z "$GATEWAYDEV"; then echo "No gateway device found" else echo "Masquerading using $GATEWAYDEV" /sbin/iptables -t nat -A POSTROUTING -o $GATEWAYDEV -j MASQUERADE fi echo "Enabling IP forwarding" echo 1 > /proc/sys/net/ipv4/ip_forward echo "IP forwarding set to `cat /proc/sys/net/ipv4/ip_forward`" echo "done." ;; *) echo "Usage: $0 {start|restart|status}" ;; esac
The script looks fine to me. Although the "iptables -F" line would kill all iptables rules that were added before this script gets run. In general this would seem something that's better configured on a per-interface basis. But I'm no expert when it comes to RHEL configuration. Thanks!
I propose this section is removed or marked Xen specific. I think it could be replaced by: http://documentation-stage.bne.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Virtualization/chap-Virtualization-Network_Configuration.html That method covers using libvirt for NAT and bridging which is our preferred method for RHEL 5.4 (with the introduction of KVM). My question is now whether this procedure will work for older versions of RHEL (that is anything earlier than 5.4)?
Yes, AFAIK, the section Mark pointed to should work with all versions of Xen in RHEL5. I've certainly been running that config since 5.2
Rock, well I shall remore or relabel the old section as Xen legacy.