Wednesday, September 22, 2010

network eth0 eth1

Linux Network eth0 eth1 routes

[root@ashok-web network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
HWADDR=00:1E:0B:CC:11:FC
ONBOOT=no
TYPE=Ethernet
IPADDR=192.168.1.10
NETMASK=255.255.255.0
 
[root@ashok-web network-scripts]# cat /etc/sysconfig/network-scripts/route-eth1 
GATEWAY0=192.168.1.1
NETMASK0=255.255.248.0
ADDRESS0=192.20.248.0 
 
These variables have "0" appended to their names so they don't overwrite
 the main settings.  The gateway addresses are the first and second IPs 
below the broadcast address for your network configuration.  Use the 
appropriate GATEWAY for your backup network subnet.  
GATEWAY1= NETMASK1=  ADDRESS1= GATEWAY2= ADDRESS2= NETMASK2= 
traceroute -i eth1 www.example.com

Redhat Linux

The Linux interface for forcing these parameters is a little simpler (at least for Redhat and derivatives). To ensure that an interface always comes up with a certain configuration you make a change to this file (for eth0, change number for other interfaces):

/etc/sysconfig/network-scripts/ifcfg-eth0 
 
Append this line to the file to force 100Mb Full Duplex with auto negotiation off 

ETHTOOL_OPTS="speed 100 duplex full autoneg off"

However, if your backup network is GigE, you have to leave it with autoneg on
 
ETHTOOL_OPTS="autoneg on"

That takes care of the permanent settings, to force a change immediately the ethtool command is used. It can also be used to obtain the current settings, as below
 
linux-web# ethtool eth0 
Settings for eth0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Full Port: MII PHYAD: 24 Transceiver: internal Auto-negotiation: on Current message level: 0x00000001 (1) Link detected: yes

The command to force 100Mb Full duplex would be
 
ethtool -s eth0 speed 100 duplex full
Cheers!

rsync with delete option and different ssh port

How to rsync e.g PIPELINE dir from Source to Destination? #rsync -avzr   --delete-before  -e "ssh -p $portNumber"  /local...