How to assign network in RHEL 7?
networking two ways
lagacy
network manager
networkmanager
--------------
rpm -qa | grep -i Networkmanager
systemctl status NetworkManager
There are three different ways assign network settings
GUI ----->Graphical
text ... nmtui --->Text based
cli .... nmcli ----> Command line
Using lagacy network service
----------------------
planing to add manually values for eth0
vim /etc/sysconfig/netwok-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
for static
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none or static
IPADDR=172.25.X.11
PREFIX=24 or NETMASK=255.255.255.0
GATEWAY=172.25.X.254
DNS1=172.25.254.254
:wq
sytemctl restart NetworkManager
To assign system name (hostname)
hostnamectl set-hostname serverx.example.com
or
vim /etc/hostname
serverx.example.com
before rhel7 .....to set hostname
vim /etc/sysconfig/network
HOSTNAME=serverx.example.com
updating name server info
vim /etc/resolv.conf
nameserver 8.8.8.8
or local dns 172.25.254.254
local name mapping
------------------
if u have to systems .... call with nicknames ...alias name user /etc/hosts
give ip call that system with name ( nss switch will manage this proccess)
ex:- 172.25.x.11 system1
172.25.x.10 system2
vim /etc/hosts
172.25.x.11 system1
172.25.x.10 system2
:wq
using nmtui
nmtui stands
for Network Manager Text User Interface.
nmtui is
actually a very easy text based tool to configure IP address and host names.
Just type “nmtui” on command prompt and follow the simple steps
Now choose
your connection type after selecting “Edit a connection”. I am choosing
ethernet as I don’t have any other connection to my virtual machine.
As I showing here in rhel7
configuring IP addresses. So I had selected “edit” to manually set the ip
address
Now after selecting “manual” you can
configure ip addresses as per your specifications.
After you press “OK” to come out of
this window. Don’t forget to activate the network connection again.
Once you are done with the nmtui tool
in rhel7 configuring IP addresses. You
can check using ‘ifconfig or ip a or hostname –i.
Using
nmcli (Network Manager Command Line Interface )
show the connections using
nmcli
connection show
nmcli
connection show eno1
Configure an IP address
nmcli
connection modify eno1 ipv4.addresses 192.168.0.5/24
Configure an IP address with default
gateway
nmcli
connection modify eno1 ipv4.addresses 192.168.0.5/24 \ ipv4.gateway 192.168.0.1 ipv4.never-default no
Configure an additional IP address
nmcli
connection modify eno1 +ipv4.addresses 192.168.0.6
Add a static route
These will
be saved in the route-<interface> file in /etc/sysconfig/network-scripts/
:
nmcli
connection modify eno1 +ipv4.routes '192.168.111.0/24 192.168.99.1'
No comments:
Post a Comment