Ex no1 (1)

26
EXNO:12 NETWORKING AND INTERFACE PROCEDURE: 1. To get the current user who logged in and to switch user [admin@FossServer ~]$ whoami admin [admin@FossServer ~]$ su Password: [root@FossServer admin]# whoami root 2. To set the IP addresss [root@FossServer network-scripts]# ifconfig eth0 Link encap:Ethernet HWaddr

description

 

Transcript of Ex no1 (1)

Page 1: Ex no1 (1)

EXNO:12 NETWORKING AND INTERFACE

PROCEDURE:

1. To get the current user who logged in and to switch user

[admin@FossServer ~]$ whoami

admin

[admin@FossServer ~]$ su

Password:

[root@FossServer admin]# whoami

root

2. To set the IP addresss

[root@FossServer network-scripts]# ifconfig

eth0 Link encap:Ethernet HWaddr E0:69:95:00:89:20

inet addr:172.16.121.45 Bcast:172.16.255.255 Mask:255.255.0.0

inet6 addr: fe80::e269:95ff:fe00:8920/64 Scope:Link

Page 2: Ex no1 (1)

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

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

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

collisions:0 txqueuelen:1000

RX bytes:1030758 (1006.5 KiB) TX bytes:7458 (7.2 KiB)

Interrupt:20 Memory:fe400000-fe420000

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

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

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

collisions:0 txqueuelen:0

RX bytes:4752 (4.6 KiB) TX bytes:4752 (4.6 KiB)

Page 3: Ex no1 (1)

[root@FossServer network-scripts]# service NetworkManager status

NetworkManager (pid 2648) is running...

[root@FossServer network-scripts]# service NetworkManager stop

Stopping NetworkManager daemon: [ OK ]

[root@FossServer network-scripts]# ifconfig

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

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

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

collisions:0 txqueuelen:0

RX bytes:4752 (4.6 KiB) TX bytes:4752 (4.6 KiB)

[root@FossServer network-scripts]# ifconfig eth0

Page 4: Ex no1 (1)

eth0 Link encap:Ethernet HWaddr E0:69:95:00:89:20

inet addr:172.16.121.45 Bcast:172.16.255.255 Mask:255.255.0.0

BROADCAST MULTICAST MTU:1500 Metric:1

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

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

collisions:0 txqueuelen:1000

RX bytes:1048164 (1023.5 KiB) TX bytes:7458 (7.2 KiB)

Interrupt:20 Memory:fe400000-fe420000

[root@FossServer network-scripts]# service network status

Configured devices:

lo eth0

Currently active devices:

lo

[root@FossServer network-scripts]# service network stop

Page 5: Ex no1 (1)

Shutting down loopback interface: [ OK ]

[root@FossServer network-scripts]# ifconfig

[root@FossServer network-scripts]# ifdown eth0

[root@FossServer network-scripts]# ifdown lo

[root@FossServer network-scripts]# ifconfig eth0 172.16.121.45 netmask 255.255.0.0 up

[root@FossServer network-scripts]# ifconfig

eth0 Link encap:Ethernet HWaddr E0:69:95:00:89:20

inet addr:172.16.121.45 Bcast:172.16.255.255 Mask:255.255.0.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

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

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

collisions:0 txqueuelen:1000

RX bytes:1068024 (1.0 MiB) TX bytes:8564 (8.3 KiB)

Interrupt:20 Memory:fe400000-fe420000

Page 6: Ex no1 (1)

[root@FossServer network-scripts]# ifconfig lo

lo Link encap:Local Loopback

LOOPBACK MTU:16436 Metric:1

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

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

collisions:0 txqueuelen:0

RX bytes:4752 (4.6 KiB) TX bytes:4752 (4.6 KiB)

[root@FossServer network-scripts]# ifup lo

[root@FossServer network-scripts]# ifconfig

eth0 Link encap:Ethernet HWaddr E0:69:95:00:89:20

inet addr:172.16.121.45 Bcast:172.16.255.255 Mask:255.255.0.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

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

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

Page 7: Ex no1 (1)

collisions:0 txqueuelen:1000

RX bytes:1100369 (1.0 MiB) TX bytes:8564 (8.3 KiB)

Interrupt:20 Memory:fe400000-fe420000

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

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

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

collisions:0 txqueuelen:0

RX bytes:4752 (4.6 KiB) TX bytes:4752 (4.6 KiB)

[root@FossServer network-scripts]#

3. To set the GATEWAY ip address

Page 8: Ex no1 (1)

[root@FossServer network-scripts]# route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0

[root@FossServer network-scripts]# route add default gw 172.16.121.1

[root@FossServer network-scripts]# route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0

0.0.0.0 172.16.121.1 0.0.0.0 UG 0 0 0 eth0

4. To set the DNS ip

[admin@FossServer etc]$ su

Password:

[root@FossServer ~]$ pwd

Page 9: Ex no1 (1)

/home/admin

[admin@FossServer ~]$ cd /etc

[root@FossServer etc]# pwd

/etc

[root@FossServer etc]# ls

abrt init rc

acpi init.d rc0.d

adjtime inittab rc1.d

aliases inputrc rc2.d

aliases.db iproute2 rc3.d

alsa ipsec.conf rc4.d

alternatives ipsec.d rc5.d

anacrontab ipsec.secrets rc6.d

ant.conf issue rc.d

ant.d issue.net rc.local

anthy-conf java rc.sysinit

Page 10: Ex no1 (1)

asound.conf jvm readahead.conf

at.deny jvm-commmon reader.conf.d

audisp jwhois.conf redhat-release

audit kde report.conf

avahi krb5.conf report.d

BackupPC ld.so.cache request-key.conf

bash_completion.d ld.so.conf resolv.conf

bashrc ld.so.conf.d rmt

blkid lftp.conf rpc

bluetooth libaudit.conf rpm

bonobo-activation libuser.conf rsyslog.conf

cgconfig.conf localtime rwtab

cgrules.conf login.defs rwtab.d

chkconfig.d logrotate.conf samba

ConsoleKit logrotate.d sane.d

cron.d ltrace.conf sasl2

Page 11: Ex no1 (1)

cron.daily lvm screenrc

cron.deny mail securetty

cron.hourly mailcap security

cron.monthly mail.rc selinux

crontab man_db.conf services

cron.weekly maven sestatus.conf

crypttab mdadm.conf setroubleshoot

csh.cshrc mime.types setuptool.d

csh.login mke2fs.conf sgml

cups modprobe.d shadow

dbus-1 motd shadow-

default mtab shells

depmod.d mtab.fuselock skel

dhcp mtools.conf slrn.rc

DIR_COLORS multipath smartd.conf

DIR_COLORS.256color Muttrc smolt

Page 12: Ex no1 (1)

DIR_COLORS.lightbgcolor Muttrc.local smrsh

dnsmasq.conf my.cnf snmp

dnsmasq.d nanorc sos.conf

dracut.conf netconfig sound

dracut.conf.d NetworkManager squid

dumpdates networks ssh

elinks.conf nfsmount.conf ssl

environment nsswitch.conf sssd

ethers ntp statetab

exports ntp.conf statetab.d

favicon.png obex-data-server stunnel

fedora-release odbc.ini subversion

festival odbcinst.ini sudoers

filesystems openldap sudoers.d

fonts openvpn sysconfig

foomatic opt sysctl.conf

Page 13: Ex no1 (1)

fprintd.conf PackageKit systemd

fstab pam.d system-release

gconf pam_pkcs11 system-release-cpe

gcrypt pango terminfo

gdm passwd udev

ghostscript passwd- updatedb.conf

gimp pbm2ppa.conf UPower

gnome-settings-daemon pcmcia urlview.conf

gnome-vfs-2.0 php.d usb_modeswitch.conf

gnupg php.ini usb_modeswitch.d

gpm-root.conf pinforc vimrc

gpm-syn.conf pki virc

gpm-twiddler.conf plymouth vpnc

gre.d pm vsftpd

GREP_COLORS pm-utils-hd-apm-restore.conf warnquota.conf

Page 14: Ex no1 (1)

group pnm2ppa.conf webalizer.conf

group- polkit-1 wgetrc

grub.conf popt.d wpa_supplicant

gshadow portreserve X11

gshadow- ppp xdg

gssapi_mech.conf prelink.cache xinetd.d

gtk-2.0 prelink.conf xml

gtk-3.0 prelink.conf.d yp.conf

hal printcap yum

host.conf profile yum.conf

hosts profile.d yum.repos.d

hosts.allow protocols zlogin

hosts.deny pulse zlogout

hp purple zprofile

httpd quotagrpadmins zshenv

idmapd.conf quotatab zshrc

Page 15: Ex no1 (1)

[root@FossServer etc]#

5. edit resolv.conf file to set the DNS ip addr

[root@FossServer etc]# vi resolv.conf

6. Add the text below in the file at bottom

nameserver 172.16.121.2

7. To set the IP address permanently follow the steps below

[root@FossServer etc]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"

HWADDR="E0:69:95:00:89:20"

NM_CONTROLLED="yes"

ONBOOT="no"

BOOTPROTO=none

IPV6INIT="no"

~

8. update the above file as below

DEVICE="eth0"

Page 16: Ex no1 (1)

HWADDR="E0:69:95:00:89:20"

NM_CONTROLLED="yes"

ONBOOT="yes"

BOOTPROTO=static

IPV6INIT="no"

IPADDR=172.16.121.45

NETMASK=255.255.0.0

GATEWAY=172.16.121.1

DNS=172.16.121.2

9. save the file and quit the editor.10. Next start the network and networkmanager

services

[root@FossServer etc]# service network restart

Shutting down interface eth0: [ OK ]

Shutting down loopback interface: [ OK ]

Bringing up loopback interface: [ OK ]

Page 17: Ex no1 (1)

Bringing up interface eth0: [ OK ]

[root@FossServer etc]# service NetworkManager restart

Stopping NetworkManager daemon: [FAILED]

Setting network parameters... [ OK ]

Starting NetworkManager daemon: [ OK ]