Archive

Archive for the ‘Linux Networking’ Category

IP Bonding or Teaming in Linux – RHEL 5

June 24th, 2009

IP Bonding or Teaming is a method of combining all the network interfaces togather into one with one of the types like Network Fault Tolerance, Round Robin, Back up, Loadbalancing etc. So it looks virtually as a single interface to the outside world providing high availability, based on the type you have set. Means, in a Network fault tolerant type one will take over if other fails and in a Load Balancing type trafic is shared when one busy to the other.

I got a chance of doing IP bonding in a HP Proliant Servers running RHEL 5. Everthing went well with no issues. Let me share my experience with my blog readers. In linux IP bonding is quite simple and is done with some kernel modules and no extra package is to be installed. In Windows, bonging or teaming is done with some software. With HP server, it can easily be done with some HP Network Configuration Uitlities.
Two establish IP bonding you need a minimum of two nework interfaces

Step 1:Check your network interfaces

#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: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: g
Current message level: 0×00000007 (7)
Link detected: yes

#ethtool eth1
Settings for eth1:
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: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: g
Current message level: 0×00000007 (7)
Link detected: yes

Step 2: Check all the requiured kernel modules are available(bonding and mii)

#modprobe –list | grep bonding

/lib/modules/2.6.18-92.el5/kernel/drivers/net/bonding/bonding.ko

# modprobe –list | grep mii

/lib/modules/2.6.18-92.el5/kernel/drivers/net/mii.ko

Step 3: Editing the modprobe.conf file

#vim /etc/modprobe.conf

and add the following lines at the end

alias bond0 bonding

options bond0 mode=1 arp_ip_target=192.168.52.1 arp_interval=200 primary=eth0

To know more about the parameters to be used here use the command

#modinfo bonding

filename: /lib/modules/2.6.18-92.el5/kernel/drivers/net/bonding/bonding.ko

author: Thomas Davis, tadavis@lbl.gov and many others

description: Ethernet Channel Bonding Driver, v3.2.4

version: 3.2.4

license: GPL

srcversion: DB2ABCD47A83F8567EBE92B

depends:

vermagic: 2.6.18-92.el5 SMP mod_unload gcc-4.1

parm: max_bonds:Max number of bonded devices (int)

parm: miimon:Link check interval in milliseconds (int)

parm: updelay:Delay before considering link up, in milliseconds (int)

parm: downdelay:Delay before considering link down, in milliseconds (int)

parm: use_carrier:Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default) (int)

parm: mode:Mode of operation : 0 for balance-rr, 1 for active-backup, 2 for balance-xor, 3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, 6 for balance-alb (charp)

parm: primary:Primary network device to use (charp)

parm: lacp_rate:LACPDU tx rate to request from 802.3ad partner (slow/fast) (charp)

parm: xmit_hash_policy:XOR hashing method: 0 for layer 2 (default), 1 for layer 3+4 (charp)

parm: arp_interval:arp interval in milliseconds (int)

parm: arp_ip_target:arp targets in n.n.n.n form (array of charp)

parm: arp_validate:validate src/dst of ARP probes: none (default), active, backup or all (charp)

parm: fail_over_mac:For active-backup, do not set all slaves to the same MAC. 0 of off (default), 1 for on. (int)

module_sig: 883f35048175a9e6e24e25c96667c37112449509f5739ebf283efa5295d315b73cee5e956f6e25709cbcf2826571c5ffc20f2d87672bb921d610d7

Step 3: Now load the modules

<!– @page { size: 8.27in 11.69in; margin: 0.79in } P { margin-bottom: 0.08in } –>

#modprobe bonding

#modprobe mii

This will create a bond0 config file in the networks-scripts directory

Step 4: Editting the three configuration files for eth0,eth1,bond0

|# vim /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0

BOOTPROTO=none

ONBOOT=yes

NETMASK=255.255.255.0

IPADDR=192.168.52.4

USERCTL=no

GATEWAY=192.168.52.1

TYPE=Ethernet

IPV6INIT=no

PEERDNS=yes

#vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=none

ONBOOT=yes

MASTER=bond0

SLAVE=yes

USERCTL=no

TYPE=Ethernet

#vim /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

BOOTPROTO=none

ONBOOT=yes

MASTER=bond0

SLAVE=yes

USERCTL=no

TYPE=Ethernet

Step5: Restart your networks service

#/etc/init.d/network restart

#ifconfig

Now use ifconfig command to check the, you will look a new interface called bond0 has been created.  The ip you set for it is going to be your ip address of the system. Enjoy bonding

Bash, Linux, Linux Networking , , ,

Samba File sharing between two ubuntu systems in LAN

November 3rd, 2008

With two systems connected in LAN is so easy to share files and folders in Ubuntu. Here i tell you how to share files and folders with samba file server between two ubuntu systems with few clicks. The Ubuntu Iam using here is Hardy.

The system that has source contents to be shared should have Samba server, (That can be installed in course of the procedure how to share). And the remote system that wish to access the source contents should have the Samba client. Samba client will installed be default in ubuntu, if not install it with the command

$sudo apt-get install smbclient

Here comes the procedure how to share.

Soruce Side

  1. On the source system login to ubuntu, right click on the folder you wish to share and select ‘Sharing Options’.

  2. In the Dialog box that apears select ‘Share this Folder’ check box, you will be prompted to install a service. Clicking on Install will open synaptic package manager and install the Samba Server packages.

  3. On successful Installation of the packages, the part in the server side is over.

    This will create a share automatically in Samba server on the the username you have logged in (here ‘rosario’) with its password.

Destination Side

  1. Check whether the smbclient package is installed, if not install it with the above command.

  2. Use the command like
  3. $sudo smbclient \\\\192.168.1.33\\photos -U rosario

    • where rosario is the username of the source system,
    • 192.168.1.33 is the IP address of the source system
    • photos is the name of the folders shared in the source system(In small characters)
  4. The above command first will prompt the local system password as sudo is used. And then it will prompt for the password of the remote samba server for the username rosario
  5. On giving the right password, it will take to the samba promt.

Smb: \>

Some usefull commands

  • help- To know all possible commands
  • dir- To list out all the shared directories, or contents inside the current directory
  • cd- Change Directory
  • get- To copy a specified file from the source system to the local system
  • put- To copy contents from local system to the server system

Enjoy Easy File Sharing With Ubuntu…

Linux Networking, Ubuntu ,

Wireless Lan Switch Problem in Laptops with Ubuntu 8.04

July 28th, 2008

Many laptops, that uses Intel board faces problems with Wlan. That is, most of the time when booted with Ubuntu 8.04 the Wlan will not be enabled and the WirelessLan switch in the laptops will not be of any use… More over the Wireless Lan leds will also be of no use. I faced the same problem and i happened to reboot my ubuntu severall times to get my wlan enabled.

I googled and had a chat in IRC and found it a bug with Ubuntu. Also found the solution as i was surfing. The solution to the above problem is making the WLAN led glow and making the WLAN switch work. For that install the package below using Synaptic or atp-get

linux-backports-modules-hardy

that is install like

~$ sudo apt-get install linux-backports-modules-hardy

Even if it doesnt work after this, install the Latest stable version of ndiswrapper from the link,

http://downloads.sourceforge.net/ndiswrapper

Iam right now using my Dataone connection, in my Lap via wlan as my modem is Wireless enabled. I never reboot now a day to enable my Wlan enabled in my Ubuntu.

Linux Networking, Ubuntu , ,

Copying File across Between two systems in a Lan

July 9th, 2008

If in a Lan, Ping between two system to check the availability of the connection. If peer to peer, connect the lan cable. Assign the IP addresses for the two systems (Like 172.16.25.1 and 172.16.25.2 for both the systems, with subnet mask 255.255.255.0). That is the subnet addresses should be same for both the systems.

scp is the command that can be used for transfering files across the systems. Secure Copy(scp) uses Open SSH protocol for the file transfer. ftp can also be used for the file transfer. For using the scp command you must follow a rule. The rule is, the system you invoke this command should have the ssh client and the target system should have the ssh server(sshd). For copying the files from the source to the destination system, this command can be invoked in both source system or the destination system, but should follow the above rule.

The usage is the scp command is,

#scp username@<source-ip> :/path/to/the/source/file username@<destination-ip> :/path/to/the/destination/file

To copy a folder from the source system to the destination use the recursive the option,

#scp -r username@<source-ip> :/path/to/the/source/folder username@<destination-ip> :/path/to/the/destination/folder

The first user name is the user in the source system and the second username is the user in the destination system. The access privileges to the files or folder to copied or to be used as the destination folder depends on the user privileges used in the command.

Linux Networking , ,