You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@vcl.apache.org by Dmitri Chebotarov <dc...@gmu.edu> on 2012/02/27 21:16:26 UTC

Linux servers with VLAN ID

Hi All,

In case if I need to use VLANs on external interface on Linux servers, what would be the good way to handle eth1.xx interfaces? 
I'm adding xCAT support for VCL and xCAT servers have external interface with VLAD id. 
The VCL script in rc.local checks for eth1, but not for eth1.xxx (which is understandable). 

I plan to change 1st two lines to:

IP0=$(ifconfig | grep "inet addr:"|awk '{print $2}' | awk -F: '{print $2}'|awk '{ if (NR==1) print $0 }')
IP1=$(ifconfig | grep "inet addr:"|awk '{print $2}' | awk -F: '{print $2}'|awk '{ if (NR==2) print $0 }')

or to:

IF0=$(ip -f inet addr|grep inet |grep eth0| awk {'print $7'})
IF1=$(ip -f inet addr|grep inet |grep eth1| awk {'print $7'})

IP0=$(ifconfig $IF0 | grep inet | awk '{print $2}' | awk -F: '{print $2}')
IP1=$(ifconfig $IF1 | grep inet | awk '{print $2}' | awk -F: '{print $2}')

and wanted to ask if anyone had to solve similar problem in the past and may be have different solution. 

I cannot hardcode eth1.VLANID, b/c the same VCL is used for VMs as well, and those don't have VLANs (VLANs done by ESXi host)

This is original script, which I plan to change:

# This file will get overwritten during image capture. Any customizations
# should be put into /etc/init.d/vcl_post_reserve or /etc/init.d/vcl_post_load
# Note these files do not exist by default.

IP0=$(ifconfig eth0 | grep inet | awk '{print $2}' | awk -F: '{print $2}')
IP1=$(ifconfig eth1 | grep inet | awk '{print $2}' | awk -F: '{print $2}')

sed -i -e '/.*AllowUsers .*$/d' /etc/ssh/sshd_config
sed -i -e '/.*ListenAddress .*/d' /etc/ssh/sshd_config
sed -i -e '/.*ListenAddress .*/d' /etc/ssh/external_sshd_config
echo "AllowUsers root" >> /etc/ssh/sshd_config
echo "ListenAddress $IP0" >> /etc/ssh/sshd_config
echo "ListenAddress $IP1" >> /etc/ssh/external_sshd_config
/etc/rc.d/init.d/ext_sshd stop
/etc/rc.d/init.d/sshd stop
sleep 2
/etc/rc.d/init.d/sshd start
/etc/rc.d/init.d/ext_sshd start


Thank you.

-----------------
Dmitri Chebotarov
dchebota@gmu.edu
703-993-6175
-----------------



Re: Linux servers with VLAN ID

Posted by Dmitri Chebotarov <dc...@gmu.edu>.
Hi All

Please ignore this question.

I fixed it with adding a boot script to Linux bare-metal image (in /etc/init.d) to replace eth1 with eth1.xxxx in /etc/rc.local file using sed.

Thanks. 

On Feb 27, 2012, at 15:16 , Dmitri Chebotarov wrote:

> Hi All,
> 
> In case if I need to use VLANs on external interface on Linux servers, what would be the good way to handle eth1.xx interfaces? 
> I'm adding xCAT support for VCL and xCAT servers have external interface with VLAD id. 
> The VCL script in rc.local checks for eth1, but not for eth1.xxx (which is understandable). 
> 
> I plan to change 1st two lines to:
> 
> IP0=$(ifconfig | grep "inet addr:"|awk '{print $2}' | awk -F: '{print $2}'|awk '{ if (NR==1) print $0 }')
> IP1=$(ifconfig | grep "inet addr:"|awk '{print $2}' | awk -F: '{print $2}'|awk '{ if (NR==2) print $0 }')
> 
> or to:
> 
> IF0=$(ip -f inet addr|grep inet |grep eth0| awk {'print $7'})
> IF1=$(ip -f inet addr|grep inet |grep eth1| awk {'print $7'})
> 
> IP0=$(ifconfig $IF0 | grep inet | awk '{print $2}' | awk -F: '{print $2}')
> IP1=$(ifconfig $IF1 | grep inet | awk '{print $2}' | awk -F: '{print $2}')
> 
> and wanted to ask if anyone had to solve similar problem in the past and may be have different solution. 
> 
> I cannot hardcode eth1.VLANID, b/c the same VCL is used for VMs as well, and those don't have VLANs (VLANs done by ESXi host)
> 
> This is original script, which I plan to change:
> 
> # This file will get overwritten during image capture. Any customizations
> # should be put into /etc/init.d/vcl_post_reserve or /etc/init.d/vcl_post_load
> # Note these files do not exist by default.
> 
> IP0=$(ifconfig eth0 | grep inet | awk '{print $2}' | awk -F: '{print $2}')
> IP1=$(ifconfig eth1 | grep inet | awk '{print $2}' | awk -F: '{print $2}')
> 
> sed -i -e '/.*AllowUsers .*$/d' /etc/ssh/sshd_config
> sed -i -e '/.*ListenAddress .*/d' /etc/ssh/sshd_config
> sed -i -e '/.*ListenAddress .*/d' /etc/ssh/external_sshd_config
> echo "AllowUsers root" >> /etc/ssh/sshd_config
> echo "ListenAddress $IP0" >> /etc/ssh/sshd_config
> echo "ListenAddress $IP1" >> /etc/ssh/external_sshd_config
> /etc/rc.d/init.d/ext_sshd stop
> /etc/rc.d/init.d/sshd stop
> sleep 2
> /etc/rc.d/init.d/sshd start
> /etc/rc.d/init.d/ext_sshd start
> 
> 
> Thank you.
> 
> -----------------
> Dmitri Chebotarov
> dchebota@gmu.edu
> 703-993-6175
> -----------------
> 
> 




Thank you.

-----------------
Dmitri Chebotarov
dchebota@gmu.edu
703-993-6175
-----------------