SCP – SecureCopy

Simple scp transfer from Server A (Source) to Server B (Destination)

1. Server A

Create a script for scp transfer called scp-filetransfer.sh on /home/admin

#########################################

#!/bin/bash

#Source
DIRA=/home/admin/Documents/
#Destination
DIRB=/home/admin/Backup

/usr/bin/scp -P 22 -r $DIRA root@i p a d d r e s s:/$DIRB

##########################################

2. Server B.

a. If you have firewall script add Server A IP address to ssh to Server B firewall script
Ex.
ServerAIP=”Server A ip address”
PrivatePort=”your private port”
IPaddr=”your public ip address – Sever B”

iptables -A INPUT -p tcp -s $ServerAIP –sport $PrivatePort -d $IPaddr –dport 22 -m state –state NEW,ESTABLISHED -j ACCEPT

b. Allow the directory to be accessible and writable.
cd /home/admin/
Ex.  chmod 750 Backup

3. Add crontab to schedule the transfer
a. crontab -e
b. append to the last line
# BACKUP DAILY 3PM
10 15 * * * /home/admin/scp-filetransfer.sh

Advertisements

Set NIC to use 100 Fullduplex

1. Check the speed used by the NIC

/sbin/ethtool eth1

[root@test]# /sbin/ethtool eth1
Settings for eth1:
Supported ports: [ TP ]
Supported link modes:   10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes:  10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000001 (1)
Link detected: yes

As you can see Speed is set to 1000Mb/s

2. Now change the speed

Edit /etc/sysconfig/network-scripts/ifcfg-eth1

Add the line on the bottom:
ETHTOOL_OPTS=”speed 100 duplex full autoneg off”

Ex.

# Intel Corporation 82574L Gigabit Network Connection
DEVICE=eth1
BOOTPROTO=static
HWADDR=5C:F3:FC:26:20:2C
ONBOOT=yes
HOTPLUG=no
TYPE=Ethernet
IPADDR=x.x.x.x
NETMASK=x.x.x.x
GATEWAY=x.x.x.x
ETHTOOL_OPTS=”speed 100 duplex full autoneg off”

3. Save the file

4. Restart the network

/sbin/network service restart

5. Once you have change it verify the speed again

[root@test]# /sbin/ethtool eth1
Settings for eth1:
Supported ports: [ TP ]
Supported link modes:   10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes:  Not reported
Advertised auto-negotiation: No
        Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000001 (1)
Link detected: yes

Speed is now set to 100Mb/s

Updating Intel NIC drivers on linux centos

1. Check first the NIC drivers version. If your drivers is not updated proceed to step 2.

[root@test]# /sbin/lspci | grep Ethernet
0b:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
15:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
24:00.0 Ethernet controller: Davicom Semiconductor, Inc. 21x4x DEC-Tulip compatible 10/100 Ethernet (rev 31)

[root@test]# /sbin/ethtool -i eth0
driver: e1000e
version: 1.2.7-k2
firmware-version: 2.0-0
bus-info: 0000:0b:00.0

[root@test]# /sbin/ethtool -i eth1
driver: e1000e
version: 1.2.7-k2
firmware-version: 2.0-0
bus-info: 0000:15:00.0

2. Make sure you have latest kernel

yum update
reboot
yum kernel-devel
yum install kernel-PAE-devel

3. Download latest driver

ex.
wget http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=15817&ProdId=3025&lang=eng

4. Untar/unzip archive:

tar zxf e1000e-x.x.x.tar.gz

5. Go to the driver src directory

cd e1000e-x.x.x/src/

6. Compile the driver module:

# make install

The binary will be installed as:

/lib/modules/<KERNEL VERSION>/kernel/drivers/net/e1000e/e1000e.[k]o
ex.
/lib/modules/2.6.18-238.19.1.el5PAE/kernel/drivers/net/e1000e/e1000e.ko

7. Load the module using either the insmod or modprobe command:

a. Removed older e1000e drivers from the kernel, before loading the new module:

rmmod e1000e; modprobe e1000e

b. insmod /lib/modules/<KERNEL VERSION>/kernel/drivers/net/e1000e/e1000e.ko
ex.
/sbin/insmod /lib/modules/2.6.18-238.19.1.el5PAE/kernel/drivers/net/e1000e/e1000e.ko

8. Check the drivers again

# /sbin/ethtool -i eth0/eth1

Heres mine:
[root@test]# /sbin/ethtool -i eth0
driver: e1000e
version: 1.5.1-NAPI
firmware-version: 2.0-0
bus-info: 0000:0b:00.0

[root@test]# /sbin/ethtool -i eth1
driver: e1000e
version: 1.5.1-NAPI
firmware-version: 2.0-0
bus-info: 0000:15:00.0

9. Double check IP on each interface if correct

10. Make a ping test

I hope it helps!