Changed gentoo-add_ip.sh to work with baselayout-vserver-1.11.14-r3 [message #1851] |
Wed, 01 March 2006 09:13  |
steffen.zieger
Messages: 43 Registered: February 2006 Location: Germany, Stuttgart
|
Member |
|
|
Hello,
I've fixed the gentoo-add_ip.sh to work again with baselayout-vserver-1.11.14-r3.
Also I've fixed a hardcoded venet0 where it wasn't necessary.
Here is a diff:
--- gentoo-add_ip.sh.orig 2006-03-01 09:46:27.806261592 +0100
+++ gentoo-add_ip.sh 2006-03-01 09:48:43.808586096 +0100
@@ -37,7 +37,7 @@
rc-update del net.eth0 &>/dev/null
ln -sf /etc/init.d/net.lo /etc/init.d/net.${VENET_DEV}
rc-update add net.lo boot &>/dev/null
- rc-update add net.venet0 default &>/dev/null
+ rc-update add net.${VENET_DEV} default &>/dev/null
if ! grep -qe "^config_eth" ${IFCFG} 2>/dev/null; then
return 0
fi
@@ -54,7 +54,7 @@
fix_net
put_param3 ${IFCFG} "config_${VENET_DEV}" ""
# add fake route
- put_param3 ${IFCFG} "routes_${VENET_DEV}" "-net ${FAKEGATEWAYNET}/24"
+ put_param3 ${IFCFG} "routes_${VENET_DEV}" "-net ${FAKEGATEWAYNET} netmask 255.255.255.255 dev ${VENET_DEV}"
add_param3 ${IFCFG} "routes_${VENET_DEV}" "default via ${FAKEGATEWAY}"
# Set up /etc/hosts
if [ ! -f ${HOSTFILE} ]; then
At the moment, I'm trying to get an gentoo-template for productivity to work.
I'm in the last steps. There is only one problem left with disk quota.
HAND,
Steffen
|
|
|
|
Re: Changed gentoo-add_ip.sh to work with baselayout-vserver-1.11.14-r3 [message #1862 is a reply to message #1858] |
Wed, 01 March 2006 22:03   |
steffen.zieger
Messages: 43 Registered: February 2006 Location: Germany, Stuttgart
|
Member |
|
|
Hello,
If you start your gentoo-vps, are there any errors shown?
What does vzlist show, after you've run vzctl VPSID start?
I can make a archive of my gentoo-vps, if you want to try with it, but at the moment, there is a problem with disk quota, as it says, that there is no space left on device.
If I check the free space with df, it says, there are 4GB left on device!?!
HAND,
Steffen
|
|
|
|
|
|
|
|
|
Re: Changed gentoo-add_ip.sh to work with baselayout-vserver-1.11.14-r3 [message #1876 is a reply to message #1875] |
Thu, 02 March 2006 16:30   |
steffen.zieger
Messages: 43 Registered: February 2006 Location: Germany, Stuttgart
|
Member |
|
|
Hello,
here is the error message if I'm having only -net 191.255.255.1 dev venet0 in /etc/conf.d/net on gentoo:
+ [[ -net 191.255.255.1/24 dev venet0 == *:* ]]
+ /sbin/route add -net 191.255.255.1/24 dev venet0
route: netmask doesn't match route address
Usage: route [-nNvee] [-FC] [<AF>] List kernel routing tables
route [-v] [-FC] {add|del|flush} ... Modify routing table for AF.
route {-h|--help} [<AF>] Detailed usage syntax for specified AF.
route {-V|--version} Display version/author and exit.
-v, --verbose be verbose
-n, --numeric don't resolve names
-e, --extend display other/more information
-F, --fib display Forwarding Information Base (default)
-C, --cache display routing cache instead of FIB
<AF>=Use '-A <af>' or '--<af>'; default: inet
List of possible address families (which support routing):
inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25)
netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)
x25 (CCITT X.25)
+ eend 4
+ local retval=4
+ shift
+ _eend 4 eerror ''
+ local retval=4 efunc=eerror msg
+ shift 2
+ [[ 4 == 0 ]]
+ [[ -n '' ]]
+ msg='[ !! ]'
+ [[ yes == yes ]] [ !! ]' echo -e ' [ !! ]
+ return 4
+ LAST_E_CMD=eend
+ return 4
+ for x in '"${routes[@]}"'
+ x='default gw 191.255.255.1'
+ ebegin 'default gw 191.255.255.1'
+ local 'msg=default gw 191.255.255.1' dots spaces=
+ [[ no == yes ]]
+ [[ -n '' ]]
+ msg='default gw 191.255.255.1 ...'
+ einfon 'default gw 191.255.255.1 ...'
+ [[ no == yes ]]
+ [[ yes != yes ]]
+ echo -ne ' * default gw 191.255.255.1 ...'
* default gw 191.255.255.1 ...+ LAST_E_CMD=einfon
+ return 0
+ [[ yes == yes ]]
+ echo
+ LAST_E_LEN=35
+ LAST_E_CMD=ebegin
+ return 0
+ [[ default gw 191.255.255.1 == *:* ]]
+ /sbin/route add default gw 191.255.255.1
SIOCADDRT: Network is unreachable
+ eend 7
It's working with
-net 191.255.255.1 netmask 255.255.255.255 dev venet0 as you can see here:
+ return 0
+ [[ -net 191.255.255.1 netmask 255.255.255.255 dev venet0 == *:* ]]
+ /sbin/route add -net 191.255.255.1 netmask 255.255.255.255 dev venet0
+ eend 0
HTH,
Steffen
PS: The way my patch is working, it's done for debian too.
debian-add_ip.sh:
up route add -net ${FAKEGATEWAY} netmask 255.255.255.255 dev ${VENET_DEV}
[Updated on: Thu, 02 March 2006 16:32] Report message to a moderator
|
|
|
|
Re: Changed gentoo-add_ip.sh to work with baselayout-vserver-1.11.14-r3 [message #1946 is a reply to message #1944] |
Thu, 09 March 2006 16:25   |
steffen.zieger
Messages: 43 Registered: February 2006 Location: Germany, Stuttgart
|
Member |
|
|
Sorry for the noise, it isn't solved in 3.0.0-2.
But I've got another issue. Don't worry, it's on the same subject.
If the route is added like this:
/sbin/route add -net 191.255.255.0 netmask 255.255.255.255 dev venet0
it isn't working. The route is probably added, but the default gateway couldn't be added.
Here is the error:
+ /sbin/route add default gw 191.255.255.1
SIOCADDRT: Network is unreachable
If I'm changing the first mentioned line to the following:
/sbin/route add -net 191.255.255.1 netmask 255.255.255.255 dev venet0
it's working as expected.
Patch for gentoo-add_ip.sh
--- gentoo-add_ip.sh.orig 2006-03-09 17:18:49.632621776 +0100
+++ gentoo-add_ip.sh 2006-03-09 17:20:27.096804968 +0100
@@ -22,7 +22,6 @@
VENET_DEV=venet0
FAKEGATEWAY=191.255.255.1
-FAKEGATEWAYNET=191.255.255.0
IFCFG_DIR=/etc/conf.d
IFCFG=${IFCFG_DIR}/net
@@ -37,7 +36,7 @@
rc-update del net.eth0 &>/dev/null
ln -sf /etc/init.d/net.lo /etc/init.d/net.${VENET_DEV}
rc-update add net.lo boot &>/dev/null
- rc-update add net.venet0 default &>/dev/null
+ rc-update add net.${VENET_DEV} default &>/dev/null
if ! grep -qe "^config_eth" ${IFCFG} 2>/dev/null; then
return 0
fi
@@ -54,7 +53,7 @@
fix_net
put_param3 ${IFCFG} "config_${VENET_DEV}" ""
# add fake route
- put_param3 ${IFCFG} "routes_${VENET_DEV}" "-net ${FAKEGATEWAYNET}/24"
+ put_param3 ${IFCFG} "routes_${VENET_DEV}" "-net ${FAKEGATEWAY} netmask 255.255.255.255 dev ${VENET_DEV}"
add_param3 ${IFCFG} "routes_${VENET_DEV}" "default via ${FAKEGATEWAY}"
# Set up /etc/hosts
if [ ! -f ${HOSTFILE} ]; then
Patch for debian-add_ip.sh
--- debian-add_ip.sh.orig 2006-03-09 17:18:59.885063168 +0100
+++ debian-add_ip.sh 2006-03-09 17:20:40.979694448 +0100
@@ -22,7 +22,6 @@
VENET_DEV=venet0
LOOPBACK=lo
FAKEGATEWAY=191.255.255.1
-FAKEGATEWAYNET=191.255.255.0
CFGFILE=/etc/network/interfaces
HOSTFILE=/etc/hosts
Patch for slackware-9-add_ip.sh
--- slackware-9.x_add_ip.sh.orig 2006-03-09 17:19:13.631973320 +0100
+++ slackware-9.x_add_ip.sh 2006-03-09 17:20:51.514092976 +0100
@@ -23,7 +23,6 @@
VENET_DEV=venet0
FAKEGATEWAY=191.255.255.1
-FAKEGATEWAYNET=191.255.255.0
IFCFG_DIR=/etc/rc.d
IFCFG=${IFCFG_DIR}/rc.inet1
Patch for slackware-add_ip.sh
--- slackware-add_ip.sh.orig 2006-03-09 17:19:23.728438424 +0100
+++ slackware-add_ip.sh 2006-03-09 17:21:03.118328864 +0100
@@ -23,7 +23,6 @@
VENET_DEV=venet0
FAKEGATEWAY=191.255.255.1
-FAKEGATEWAYNET=191.255.255.0
IFCFG_DIR=/etc/rc.d
IFCFG=${IFCFG_DIR}/rc.inet1.conf
I've removed the unused ${FAKEGATEWAYNET} where I've found it.
The released patch for gentoo-add_ip.sh fixes all reported errors of me.
HTH,
Steffen
PS: The noise I've made was louder than I've thought
|
|
|
|
|
|
|
|
Re: Changed gentoo-add_ip.sh to work with baselayout-vserver-1.11.14-r3 [message #1985 is a reply to message #1984] |
Sat, 11 March 2006 10:27   |
Jason Stubbs
Messages: 18 Registered: March 2006 Location: Japan
|
Junior Member |
|
|
UPDATE: It seems the patch didn't get lost. It's been sitting in subversion and awaiting a release. I've asked that baselayout-vserver get a bump with the patch included until baselayout itself is ready for another release. The bug can be tracked at http://bugs.gentoo.org/show_bug.cgi?id=125786
The following snippet is from the baselayout's iproute2 module:
iproute2_post_start() {
local iface=${1} ifvar=$( interface_variable ${1} ) routes e r
# Make sure interface is marked UP
iproute2_up ${iface}
eval routes=( \"\$\{routes_${ifvar}\[@\]\}\" )
# Test for old style ipaddr variable
if [[ -z ${routes} ]]; then
eval routes=( \"\$\{iproute_${ifvar}\[@\]\}\" )
fi
[[ -z ${routes} ]] && return 0
# Set routes with ip route -- this might also include default route
einfo "Adding routes"
eindent
for x in "${routes[@]}"; do
# Support net-tools routing too
x=${x//gw/via}
x=${x//-A inet6}
einfo "${x}"
e=$( ip route append dev ${iface} ${x} 2>&1 )
case "${e}" in
'RTNETLINK answers: File exists'|'')
eend 0
;;
*) printf '%s\n' "${e}" >&2
eend 1
;;
esac
done
eoutdent
return 0
}
The routes variables takes on the value of whatever routes_venet0 is so with a value of ( "default via 191.255.255.1 dev venet0" ) the command would end up being `ip route append dev venet0 default via 191.255.255.1 dev venet0`. The same thing will happen with either the iproute2 module or ifconfig module with the newer baselayout version.
In my opinion, I would say it the best course of action would be to leave vzctl as it is for the moment. I opened a bug with Gentoo today (as I should have done in the first place) as my 'verbal' report seems to have got lost. It shouldn't take too long for a newer version to come out. Either hollow or uberlord on irc.freenode.net could give you a better idea on the timeline.
[Updated on: Sat, 11 March 2006 12:31] Report message to a moderator
|
|
|
Re: Changed gentoo-add_ip.sh to work with baselayout-vserver-1.11.14-r3 [message #1986 is a reply to message #1985] |
Sat, 11 March 2006 14:33   |
steffen.zieger
Messages: 43 Registered: February 2006 Location: Germany, Stuttgart
|
Member |
|
|
So, updating to baselayout-1.12 will 'fix' the error with dev venet0, but there is no backwards compatibility.
For example, vzctl will be updated to fix this error, it's not working with baselayout-1.12. If vzctl is not fixing this error, it's not working with baselayout-1.11.
What about telling the baselayout-vserver people on gentoo, trying to fix this bug with a check, if there is 'dev venet0' added in the routes-line and printing out a message to the user?
So it is the user, who is responsible for fixing it in /etc/conf.d/net (removing dev venet0 in case of baselayout-1.12).
Another way of fixing this is checking via emerge which baselayout-version is installed before adding the ip. I think it should be possible to check via vzctl exec VPSID 'emerge -s baselayout-vserver |grep installed |cut -d: -f 2|cut -d" " -f 2' and doing the needed things in gentoo-add_ip.sh.
Maybe there is an easier way of doing the same, I'm trying to get it to work.
HTH,
Steffen
|
|
|
|
|
Re: Changed gentoo-add_ip.sh to work with baselayout-vserver-1.11.14-r3 [message #1989 is a reply to message #1988] |
Sat, 11 March 2006 16:02   |
Jason Stubbs
Messages: 18 Registered: March 2006 Location: Japan
|
Junior Member |
|
|
Heh.. I think that we might just look at things from a different perspective. As nothing has been officially released, I personally wouldn't go out on a limb. People in production should be testing upgrades before rolling them out - especially after modifying parts of the previously installed packages.
Also, if compatibility is the biggest concern, there's no way to figure out what version of baselayout-vserver is installed long term. Parsing emerge output is unsafe as there's no guarantees it won't change, nor are there guarantees that the parameters given to emerge won't change. There isn't even a guarantee that the name "baselayout-vserver" won't change.
From my point of view, the best/most that can be done for the long term is to put the information into the release notes if there are any. Something to the effect of "Issues with Gentoo VPS networking have to been resolved. All users are advised to upgrade to vzctl-3.0.0-3 and baselayout-vserver-1.11.14-r4."
baselayout-vserver-1.11.14-r4 has just been released by the way. It should be hitting the mirrors soon.
[Updated on: Sat, 11 March 2006 16:02] Report message to a moderator
|
|
|
Re: Changed gentoo-add_ip.sh to work with baselayout-vserver-1.11.14-r3 [message #1990 is a reply to message #1989] |
Sat, 11 March 2006 17:52   |
steffen.zieger
Messages: 43 Registered: February 2006 Location: Germany, Stuttgart
|
Member |
|
|
So, we have to wait until baselayout-vserver-1.11.14-r4 is marked stable and telling people, that they should change their network-config (this is, because of some people want to have a useable gentoo-template). No problem.
I've updated to the new baselayout-vserver and it works.
Here is a new patch to gentoo-add_ip.sh:
--- gentoo-add_ip.sh.orig 2006-03-01 09:46:27.000000000 +0100
+++ gentoo-add_ip.sh 2006-03-11 18:47:52.805755280 +0100
@@ -22,7 +22,6 @@
VENET_DEV=venet0
FAKEGATEWAY=191.255.255.1
-FAKEGATEWAYNET=191.255.255.0
IFCFG_DIR=/etc/conf.d
IFCFG=${IFCFG_DIR}/net
@@ -37,7 +36,7 @@
rc-update del net.eth0 &>/dev/null
ln -sf /etc/init.d/net.lo /etc/init.d/net.${VENET_DEV}
rc-update add net.lo boot &>/dev/null
- rc-update add net.venet0 default &>/dev/null
+ rc-update add net.${VENET_DEV} default &>/dev/null
if ! grep -qe "^config_eth" ${IFCFG} 2>/dev/null; then
return 0
fi
@@ -54,7 +53,7 @@
fix_net
put_param3 ${IFCFG} "config_${VENET_DEV}" ""
# add fake route
- put_param3 ${IFCFG} "routes_${VENET_DEV}" "-net ${FAKEGATEWAYNET}/24"
+ put_param3 ${IFCFG} "routes_${VENET_DEV}" "-net ${FAKEGATEWAY} netmask 255.255.255.255"
add_param3 ${IFCFG} "routes_${VENET_DEV}" "default via ${FAKEGATEWAY}"
# Set up /etc/hosts
if [ ! -f ${HOSTFILE} ]; then
This version is working with baselayout-vserver-1.11.14-r4. Because of a bug in previous baselayout-vserver-versions you have to update to baselayout-vserver-1.11.14-r4 or newer.
HTH,
Steffen
PS@Jason: The whole gentoo-add_ip.sh-script isn't using iproute2. The problem you mentioned some posts ago (dev venet0 problem) isn't interesting for vzctl until gentoo-add_ip.sh will be updated to use iproute2. This is only an informational note.
|
|
|
|
|
Re: Changed gentoo-add_ip.sh to work with baselayout-vserver-1.11.14-r3 [message #2000 is a reply to message #1995] |
Mon, 13 March 2006 04:24  |
Jason Stubbs
Messages: 18 Registered: March 2006 Location: Japan
|
Junior Member |
|
|
put_param3 ${IFCFG} "routes_${VENET_DEV}" "-net ${FAKEGATEWAYNET}/24"
baselayout-1.11.14-r4/ifconfig: Works
baselayout-1.11.14-r4/iproute2: "-net" parameter isn't handled
baselayout-1.12.0_pre16/ifconfig: Works
baselayout-1.12.0_pre16/iproute2: Works
put_param3 ${IFCFG} "routes_${VENET_DEV}" "-net ${FAKEGATEWAY} netmask 255.255.255.255"
baselayout-1.11.14-r4/ifconfig: Works
baselayout-1.11.14-r4/iproute2: "-net" and "netmask" parameters aren't handled
baselayout-1.12.0_pre16/ifconfig: Works
baselayout-1.12.0_pre16/iproute2: "netmask" parameter isn't handled
put_param3 ${IFCFG} "routes_${VENET_DEV}" "${FAKEGATEWAY}"
baselayout-1.11.14-r4/ifconfig: Works
baselayout-1.11.14-r4/iproute2: Works
baselayout-1.12.0_pre16/ifconfig: Works
baselayout-1.12.0_pre16/iproute2: Defaults to "-net" if not specified (not a network)
put_param3 ${IFCFG} "routes_${VENET_DEV}" "${FAKEGATEWAY}/32"
baselayout-1.11.14-r4/ifconfig: Works
baselayout-1.11.14-r4/iproute2: Works
baselayout-1.12.0_pre16/ifconfig: Defaults to "-net" if not specified (ifconfig thinks /32 net is invalid)
baselayout-1.12.0_pre16/iproute2: Works
put_param3 ${IFCFG} "routes_${VENET_DEV}" "${FAKEGATEWAYNET}/24"
baselayout-1.11.14-r4/ifconfig: Works
baselayout-1.11.14-r4/iproute2: Works
baselayout-1.12.0_pre16/ifconfig: Works
baselayout-1.12.0_pre16/iproute2: Works
Hence, I'd leave it as it is now (other than the s/venet/${VENET_DEV} change) or go with:
--- gentoo-add_ip.sh.orig 2006-03-01 09:46:27.000000000 +0100
+++ gentoo-add_ip.sh 2006-03-11 18:47:52.805755280 +0100
@@ -37,7 +36,7 @@
rc-update del net.eth0 &>/dev/null
ln -sf /etc/init.d/net.lo /etc/init.d/net.${VENET_DEV}
rc-update add net.lo boot &>/dev/null
- rc-update add net.venet0 default &>/dev/null
+ rc-update add net.${VENET_DEV} default &>/dev/null
if ! grep -qe "^config_eth" ${IFCFG} 2>/dev/null; then
return 0
fi
@@ -54,7 +53,7 @@
fix_net
put_param3 ${IFCFG} "config_${VENET_DEV}" ""
# add fake route
- put_param3 ${IFCFG} "routes_${VENET_DEV}" "-net ${FAKEGATEWAYNET}/24"
+ put_param3 ${IFCFG} "routes_${VENET_DEV}" "${FAKEGATEWAYNET}/24"
add_param3 ${IFCFG} "routes_${VENET_DEV}" "default via ${FAKEGATEWAY}"
# Set up /etc/hosts
if [ ! -f ${HOSTFILE} ]; then
1.11.14 modules only handle the gw/via difference. The modules in 1.12 also handle -net and -host/scope translations. Hence, the current setting is descriptive and will be fully supported with future versions, whereas the above patch would make it less descriptive and would rely on 1.12's (likely to be forward-compatible) -net route assumption but is compatible with all versions.
[Updated on: Tue, 14 March 2006 02:37] Report message to a moderator
|
|
|