Archive for the 'Linux Support' Category

How to see the current configuration of interface

You may do it by using either ethtool or mii-tool.

1. Using mii-tool

To see the current configuration of interface.

[root@bash ~]# mii-tool -v eth0
eth0: negotiated 100baseTx-FD, link ok
product info: vendor 00:00:20, model 32 rev 1
basic mode: autonegotiation enabled
basic status: autonegotiation complete, link ok
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control

You may see that the interface supports auto-negotiation (basic mode: autonegotiation enabled) and it is operating at 100 Mb/s in full duplex mode (100baseTx-FD). As you may see, the interface can operate in modes specified in the advertising line. In order to change it to 100 Mb/s, Half Duplex mode use the same command with the following options.

[root@bash ~]# mii-tool -F 100baseTx-HD eth0

You may verify the new configuration by using the same command with option -v as shown above.

2. Using ethtool

To see the current configuration,

[root@bash ~]# 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: No
Speed: 100Mb/s
Duplex: Half
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: pg
Wake-on: d
Current message level: 0×000000c5 (197)
Link detected: yes

You may change the other settings like speed, duplex and auto negotiations as follows.

[root@bash ~]# ethtool -s eth0 duplex full|half
[root@bash ~]# ethtool -s eth0 speed 10|100|1000
[root@bash ~]# ethtool -s eth0 autoneg on|off

You may specify all those options in a single command too.

SBDavid

How to redirect port using IPTABLES

How to redirect port using IPTABLES

You can redirect the port in IPTABLES using the prerouting parameter.

Following is the command you can use to redirect the traffic of port 8080 to port 80.

$ /sbin/iptables -t nat -I PREROUTING -p tcp –dport 8080 -j REDIRECT –to-port 80
$ /etc/init.d/iptables save
$ /etc/init.d/iptables restart

You can change the ports in the above command according to your need.

Hiding folders to avoid deletion via FTP

It is better to hide tmp/usr/lib/var folders via the conf file(when accessing ftp) so that these folders will not be accessed by the users.

If it is proftpd, find out the proftpd.conf

Add the following to the proftpd.conf file:

<Directory ~>
HideGroup wheel
</Directory>

<Directory ~>
HideNoAccess yes
</Directory>

Enter the directory path near to “<Directory >”, like “<Directory /var/www/vhosts/domainName/httpdocs/folder>”

After modification, restart the FTP.

SBDavid

GRUB single user mode

GRUB single user mode

To get into the single user mode follow the steps below :

1. At the GRUB boot prompt, select the image to be booted and press e.
2. Select the line containing kernel and press e.
3. At the end of the line specify the runlevel, for single user mode specify 1. So the line looks like,

kernel /vmlinuz-2.6.16.5 ro root=LABEL=/ rhgb quiet 1

4. Press Enter to save the line, and press b to boot the modified image.
5. You will be logged to the single usermode.
6. If you only needed a root shell, in step 3, you may specify

kernel /vmlinuz-2.6.16.5 ro root=LABEL=/ rhgb quiet init=/bin/bash

Enable IPTABLES support in Linux Kernel

You need to recompile kernel to enable IPTABLES support. I am giving the steps to enable IPTABLES support during kernel recompilation.

Get into the kernel source directory:

# cd /usr/local/src/kernel
# make menuconfig

Select the following option (not as a loadable module)

Networking >> Networking options >> Network packet filtering (replaces ipchains) >> Core Netfilter Configuration >> Netfilter Xtables support (required for ip_tables) and select the all following options as modules.

Networking >> Networking options >> Network packet filtering (replaces ipchains) >> IP: Net Filter configurationS >> IP Tables support

# make
# make modules
# make modules_install
# make install

« Prev - Next »