network configuration in linux

Linuxtopic
0
Question : step by step network configuration in Linux ?

Question : step by step host configuration in centos ?

Question : how to configure a virtual network card in Linux ?

Question : step by step ip configuration in Linux ?

Question : how to disable and enable a LAN or Ethernet  card in Linux centos ?


Network Configuration

In the Network Configuration: we will configure HOSTNAME, IP Address, DNS , routing


Related configuration file


  • /etc/Resolve.conf
  • /etc/hosts
  • /etc/sysconfig/network
  • /etc/sysconfig/network-scripts/ifcfg-<device>
  • /etc/nsswitch.conf


1. resolve.conf -  its content a DNS record / List of DNS server

# vi  /etc/resolve.conf

It's responsible for  Primary , Secondary & thirty  dns record

#format

search local.lan

NameserverX.X.X.X
NameserverX.X.X.X






2 hosts -  it s content a host name , to be resolve by locally.

#Vi  /etc/hosts
#format

<IP Address> <hostname.domainname> <hostname>

10.20.2.33  khandwa.lokesh.com     khandwa



3  network  -  set hostname permanently & networking

#Vi  /etc/sysconfig/network
#format

NETWORKING =yes

HOSTNAME=lokesh





4 fcfg-<device> -  it s content IP address, h/w id etc,

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
#format

DEVICE=eth0  -----------------Device: first  etharnet  called eth0

NM_CONTROLLED=no ----- Network Manager controlled 

HWADDR=00:1e:8c:9c:10:95 - hardware Address

ONBOOT=yes   ------------------ up on system reboot

TYPE=Ethernet  --------------  Ethernet 

USERCTL=no

IPV6INIT=no ---------------------- IP Address v6

IPADDR=10.20.2.33 ----------------  IP Address v4

NETMASK=255.255.255.0 ----------- Mask












GUI Command - set all network related configuration by following command, it s a graphical and easy  tool.
# system-config-network















Here you can set ip address & DNS configuration.

To Start network Service

# service network restart
To Stop network service

# service network restart
5 nsswitch.conf : list order of host name search. Typically lok at local files, then NIS server

IP Configuration by command line 

ifconfig:- it's used to configure, or view the configuration of, a network interface.  It stands for "interface configuration". It is used to view and change the configuration of the network interfaces on your system.
# ifconfig

To view all interface


# ifconfig -a
To view specific interface
# ifconfig eth0 
To enable  interface

# ifconfig  eth0 up
OR
#ifup eth0
To disable interface
# ifconfig eth0 down
OR
#ifdown eth0
Assign the IP address,netmask & broadcast , you can use  separate

# ifconfig <device> < IP Address> netmask <netmask> broadcast < Broadcast>
# ifconfig  eth0:2  10.20.2.35 netmask 255.255.255.0 broadcast 10.20.2.255
Here eth0.2 is virtual Ethernet card / alias of Ethernet card

To disable alias

# ifconfig  eth0:2 down
How to enable promiscuous Mode:

What happens in normal mode, when a packet received by a network card, it verifies that the packet belongs to itself. If not, it drops the packet normally, but in the promiscuous mode is used to accept all the packets that flow through the network card.
# ifconfig eth0 promisc
How to disable promiscuous Mode: add - for disable

# ifconfig eth0 -promisc
How to change MAC Address:

# ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF

Create Virtual Network card: permanent

[root@khandwa ~]# cd /etc/sysconfig/network-scripts/
[root@khandwa network-scripts]# cp ifcfg-eth0 ifcfg-eth0.1
Open ifcfg-eth0:1 file and set ip address

Here ip - 10.20.2.34

Now restart network service

#service network restart




Tags:

Post a Comment

0Comments

Post a Comment (0)

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Ok, Go it!