Posted by: isaraffee | August 29, 2009

Configuring IP Address via Command Line in Mandrivia 2009

Configuring IP Address via Command Line in Mandrivia 2009

To set the IP address of your LAN card, let’s say eth0, go to:

cd /etc/sysconfig/network-scripts

vi ifcfg-eth0

DEVICE=eth0

BOOTPROTO=static

IPADDR=172.16.0.2

NETMASK=255.255.0.0

GATEWAY=172.16.0.1

ONBOOT=yes

METRIC=10

MII_NOT_SUPPORTED=no

USERCTL=yes

DNS1=172.16.0.1

RESOLV_MODS=no

LINK_DETECTION_DELAY=6

IPV6INIT=yes

IPV6TO4INIT=yes

Let’s look at my other network settings like my Wifi devices which includes a USB Wireless Network Adapter and a Huawei Broadband modem E220

Below is my USB Wireless Network Adapter settings connected as wlan1

[root@localhost network-scripts]# more ifcfg-wlan1

DEVICE=wlan1

BOOTPROTO=dhcp

ONBOOT=yes

METRIC=35

MII_NOT_SUPPORTED=no

USERCTL=yes

RESOLV_MODS=no

WIRELESS_MODE=Managed

WIRELESS_ESSID=gateway1

WIRELESS_ENC_KEY=s:somesecretpassword

WIRELESS_ENC_MODE=open

WIRELESS_WPA_DRIVER=wext

WIRELESS_WPA_REASSOCIATE=no

IPV6INIT=no

IPV6TO4INIT=no

DHCP_CLIENT=dhclient

NEEDHOSTNAME=no

PEERDNS=yes

PEERYP=yes

PEERNTPD=no

Thisi is my Huawei Broadband modem E220 configuration which is connected as ppp0

[root@localhost network-scripts]# more ifcfg-ppp0

DEVICE=ppp0

ONBOOT=yes

METRIC=40

USERCTL=yes

LINESPEED=115200

MODEMPORT=/dev/ttyUSB0

DEBUG=yes

PERSIST=yes

DEFROUTE=yes

CELLULAR_CID=3

Other Network Interface Commands

To bring up the eth0 interface:

[root@localhost network-scripts]# ifup eth0

Check the status of the interface:

[root@localhost network-scripts]# ifconfig eth0

eth0 Link encap:Ethernet HWaddr 00:E0:4D:69:5B:94

inet addr:172.16.0.2 Bcast:172.16.255.255 Mask:255.255.0.0

UP BROADCAST MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

Interrupt:32 Base address:0xe000

To bring down the eth0 :

[root@localhost network-scripts]# ifdown eth0

Check the status of the interface:

[root@localhost network-scripts]# ifconfig eth0

eth0 Link encap:Ethernet HWaddr 00:E0:4D:69:5B:94

UP BROADCAST MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

Interrupt:32 Base address:0xe000

Note: If both theh Wifi and ethernet are up, the Internet will be vety sluggish and you may not even browsr any sites as the nameserver (gateways) points to several places:

[root@localhost network-scripts]# more /etc/resolv.conf

nameserver 172.16.0.1

nameserver 202.65.244.32

nameserver 202.65.247.31

Note the private IP address above. No wonder you will not be able to visit any web sites.

So you have to bring down th eth0

[root@localhost network-scripts]# ifdown eth0

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: