Showing posts with label ifconfig. Show all posts
Showing posts with label ifconfig. Show all posts

Monday 11 September 2017

Solaris – Add/remove network interface to a running zone (dynamic Change)

This will describe how to add a network interface to a running non-global zone, without having to reboot the zone. The new interface will persist between reboots.

First you add the entry to the zone configuration. This is the part that lets it persist between reboots. This is done from the global zone:

!-[solaris]# zonecfg -z sunz01
zonecfg:slabsunz01> add net
zonecfg:slabsunz01:net> set address=XXX.XXX.XX.XXX
zonecfg:slabsunz01:net> set physical=bge0
zonecfg:slabsunz01:net> end
zonecfg:slabsunz01> verify
zonecfg:slabsunz01> commit
zonecfg:slabsunz01> exit

Now we have to manually add a new interface to the running zone. Do this from the global zone as well

!-[solaris]# ifconfig bge0 addif XXX.XXX.XX.XXX netmask XXX.XXX.X.X zone sunz01 up

Created new logical interface bge0:3

Note: The ‘addif’ tells ifconfig to create a logical interface using the next available.

!-[solaris]# ifconfig -a
lo0:1: flags=2001000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000
bge0:1: flags=1000843 mtu 1500 index 2 inet XXX.XXX.XX.XXX netmask ffffff00 broadcast XXX.XXX.XX.XXX
bge0:3: flags=1000843 mtu 1500 index 2 inet XXX.XXX.XX.XXX netmask ffffff00 broadcast XXX.XXX.XX.XXX

That's it! you're done.

In case you want to remove the interface -

To remove the interface from a running zone. From the global zone, remove the interface. You must first determine which logical interface [alias] you wish to remove.

!-[solaris]# ifconfig bge0:3 down
!-[solaris]# ifconfig bge0:3 unplumb
!-[solaris]# zonecfg -z sunz01
zonecfg:slabsunz01> remove net address=XXX.XXX.XX.XXX
zonecfg:slabsunz01> commit
zonecfg:slabsunz01> exit

Thursday 31 August 2017

ifconfig command not found in centos 7 minimal installation

By default in Centos 7 minimal installation , ifconfig command is not found, so for obtaining this command , first you need to check which packages yum provide for this.

[root@localhost]# yum provides ifconfig

Loaded plugins: fastestmirror
Repository 'Packages' is missing name in configuration, using id
Loading mirror speeds from cached hostfile
Packages/filelists_db                                                                                                                              
No matches found

Note: here no packages is installed on the system.

So, using yum we will install the net-tool rpm which is required for ifconfig command

[root@localhost]# yum install net-tools*

Loaded plugins: fastestmirror
Repository 'Packages' is missing name in configuration, using id
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.17.20131004git.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package                  Arch           Version                                   Repository                    Size

Installing:
 net-tools                x86_64         2.0-0.17.20131004git.el7         Packages                        304 k

Transaction Summary
========================================================================
Install  1 Package

Total download size: 304 k
Installed size: 917 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                     1/1
Verifying  : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                    1/1

Installed:
net-tools.x86_64 0:2.0-0.17.20131004git.el7

Complete!

Now run the ifconfig command after successfully installed the packages.

[root@localhost]# ifconfig -a
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.26.12.1  netmask 255.255.0.0  broadcast 192.26.255.255
        inet6 fe80::250:56ff:febf:f6  prefixlen 64  scopeid 0x20<link>
        ether 00:50:56:bf:00:f6  txqueuelen 1000  (Ethernet)
        RX packets 18939  bytes 1251073 (1.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 433  bytes 63109 (61.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost]# yum provides ifconfig

Loaded plugins: fastestmirror
Repository 'Packages' is missing name in configuration, using id
Loading mirror speeds from cached hostfile
net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
Repo: @Packages
Matched from:
Filename: /usr/sbin/ifconfig