Wednesday, July 13, 2016

Ubuntu Server Network Configuration Commands

Network Configuration

Ubuntu ships with a number of graphical utilities to configure your network devices. This document is geared toward server administrators and will focus on managing your network on the command line.

If you're using 16.04 LTS, you'll see primary interface "ens33" instead of legacy "ethx"

Ethernet Interfaces

Ethernet interfaces are identified by the system using the naming convention of ethX, where X represents a numeric value. The first Ethernet interface is typically identified as eth0, the second as eth1, and all others should move up in numerical order.

Identify Ethernet Interfaces

To quickly identify all available Ethernet interfaces, you can use the ifconfig command as shown below.
ifconfig -a | grep eth
eth0      Link encap:Ethernet  HWaddr 00:15:c5:4a:16:5a
Another application that can help identify all network interfaces available to your system is the lshw command. In the example below, lshw shows a single Ethernet interface with the logical name of eth0 along with bus information, driver details and all supported capabilities.
sudo lshw -class network
  *-network
       description: Ethernet interface
       product: BCM4401-B0 100Base-TX
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: eth0
       version: 02
       serial: 00:15:c5:4a:16:5a
       size: 10MB/s
       capacity: 100MB/s
       width: 32 bits
       clock: 33MHz
       capabilities: (snipped for brevity)
       configuration: (snipped for brevity)
       resources: irq:17 memory:ef9fe000-ef9fffff

Ethernet Interface Logical Names

Interface logical names are configured in the file /etc/udev/rules.d/70-persistent-net.rules. If you would like control which interface receives a particular logical name, find the line matching the interfaces physical MAC address and modify the value of NAME=ethX to the desired logical name. Reboot the system to commit your changes.

Ethernet Interface Settings

ethtool is a program that displays and changes Ethernet card settings such as auto-negotiation, port speed, duplex mode, and Wake-on-LAN. It is not installed by default, but is available for installation in the repositories.
sudo apt install ethtool
The following is an example of how to view supported features and configured settings of an Ethernet interface.
sudo ethtool eth0
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: d
        Current message level: 0x000000ff (255)
        Link detected: yes
Changes made with the ethtool command are temporary and will be lost after a reboot. If you would like to retain settings, simply add the desiredethtool command to a pre-up statement in the interface configuration file /etc/network/interfaces.
The following is an example of how the interface identified as eth0 could be permanently configured with a port speed of 1000Mb/s running in full duplex mode.
auto eth0
iface eth0 inet static
pre-up /sbin/ethtool -s eth0 speed 1000 duplex full
Although the example above shows the interface configured to use the static method, it actually works with other methods as well, such as DHCP. The example is meant to demonstrate only proper placement of the pre-up statement in relation to the rest of the interface configuration.

IP Addressing

The following section describes the process of configuring your systems IP address and default gateway needed for communicating on a local area network and the Internet.

Temporary IP Address Assignment

For temporary network configurations, you can use standard commands such as ipifconfig and route, which are also found on most other GNU/Linux operating systems. These commands allow you to configure settings which take effect immediately, however they are not persistent and will be lost after a reboot.
To temporarily configure an IP address, you can use the ifconfig command in the following manner. Just modify the IP address and subnet mask to match your network requirements.
sudo ifconfig eth0 10.0.0.100 netmask 255.255.255.0
To verify the IP address configuration of eth0, you can use the ifconfig command in the following manner.
ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:15:c5:4a:16:5a  
          inet addr:10.0.0.100  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::215:c5ff:fe4a:165a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:466475604 errors:0 dropped:0 overruns:0 frame:0
          TX packets:403172654 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2574778386 (2.5 GB)  TX bytes:1618367329 (1.6 GB)
          Interrupt:16 
To configure a default gateway, you can use the route command in the following manner. Modify the default gateway address to match your network requirements.
sudo route add default gw 10.0.0.1 eth0
To verify your default gateway configuration, you can use the route command in the following manner.
route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0        0.0.0.0         255.255.255.0   U     1      0        0 eth0
0.0.0.0         10.0.0.1        0.0.0.0         UG    0      0        0 eth0
If you require DNS for your temporary network configuration, you can add DNS server IP addresses in the file /etc/resolv.conf. In general, editing /etc/resolv.conf directly is not recommanded, but this is a temporary and non-persistent configuration. The example below shows how to enter two DNS servers to /etc/resolv.conf, which should be changed to servers appropriate for your network. A more lengthy description of the proper persistent way to do DNS client configuration is in a following section.
nameserver 8.8.8.8
nameserver 8.8.4.4
If you no longer need this configuration and wish to purge all IP configuration from an interface, you can use the ip command with the flush option as shown below.
ip addr flush eth0
Flushing the IP configuration using the ip command does not clear the contents of /etc/resolv.conf. You must remove or modify those entries manually, or re-boot which should also cause /etc/resolv.conf, which is actually now a symlink to/run/resolvconf/resolv.conf, to be re-written.

Dynamic IP Address Assignment (DHCP Client)

To configure your server to use DHCP for dynamic address assignment, add the dhcp method to the inet address family statement for the appropriate interface in the file /etc/network/interfaces. The example below assumes you are configuring your first Ethernet interface identified as eth0.
auto eth0
iface eth0 inet dhcp
By adding an interface configuration as shown above, you can manually enable the interface through the ifup command which initiates the DHCP process via dhclient.
sudo ifup eth0
To manually disable the interface, you can use the ifdown command, which in turn will initiate the DHCP release process and shut down the interface.
sudo ifdown eth0

Static IP Address Assignment

To configure your system to use a static IP address assignment, add the static method to the inet address family statement for the appropriate interface in the file /etc/network/interfaces. The example below assumes you are configuring your first Ethernet interface identified as eth0. Change the addressnetmask, and gateway values to meet the requirements of your network.
auto eth0
iface eth0 inet static
address 10.0.0.100
netmask 255.255.255.0
gateway 10.0.0.1
By adding an interface configuration as shown above, you can manually enable the interface through the ifup command.
sudo ifup eth0
To manually disable the interface, you can use the ifdown command.
sudo ifdown eth0

Loopback Interface

The loopback interface is identified by the system as lo and has a default IP address of 127.0.0.1. It can be viewed using the ifconfig command.
ifconfig lo
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:2718 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2718 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:183308 (183.3 KB)  TX bytes:183308 (183.3 KB)
By default, there should be two lines in /etc/network/interfaces responsible for automatically configuring your loopback interface. It is recommended that you keep the default settings unless you have a specific purpose for changing them. An example of the two default lines are shown below.
auto lo
iface lo inet loopback

Name Resolution

Name resolution as it relates to IP networking is the process of mapping IP addresses to hostnames, making it easier to identify resources on a network. The following section will explain how to properly configure your system for name resolution using DNS and static hostname records.

DNS Client Configuration

Traditionally, the file /etc/resolv.conf was a static configuration file that rarely needed to be changed or automatically changed via DCHP client hooks. Nowadays, a computer can switch from one network to another quite often and the resolvconf framework is now being used to track these changes and update the resolver's configuration automatically. It acts as an intermediary between programs that supply nameserver information and applications that need nameserver information. Resolvconf gets populated with information by a set of hook scripts related to network interface configuration. The most notable difference for the user is that any change manually done to /etc/resolv.conf will be lost as it gets overwritten each time something triggers resolvconf. Instead, resolvconf uses DHCP client hooks, and /etc/network/interfaces to generate a list of nameservers and domains to put in /etc/resolv.conf, which is now a symlink:
/etc/resolv.conf -> ../run/resolvconf/resolv.conf
To configure the resolver, add the IP addresses of the nameservers that are appropriate for your network in the file /etc/network/interfaces. You can also add an optional DNS suffix search-lists to match your network domain names. For each other valid resolv.conf configuration option, you can include, in the stanza, one line beginning with that option name with a dns- prefix. The resulting file might look like the following:
iface eth0 inet static
    address 192.168.3.3
    netmask 255.255.255.0
    gateway 192.168.3.1
    dns-search example.com
    dns-nameservers 192.168.3.45 192.168.8.10
The search option can also be used with multiple domain names so that DNS queries will be appended in the order in which they are entered. For example, your network may have multiple sub-domains to search; a parent domain of example.com, and two sub-domains, sales.example.com anddev.example.com.
If you have multiple domains you wish to search, your configuration might look like the following:
iface eth0 inet static
    address 192.168.3.3
    netmask 255.255.255.0
    gateway 192.168.3.1
    dns-search example.com sales.example.com dev.example.com
    dns-nameservers 192.168.3.45 192.168.8.10
If you try to ping a host with the name of server1, your system will automatically query DNS for its Fully Qualified Domain Name (FQDN) in the following order:
  1. server1.example.com
  2. server1.sales.example.com
  3. server1.dev.example.com
If no matches are found, the DNS server will provide a result of notfound and the DNS query will fail.

Static Hostnames

Static hostnames are locally defined hostname-to-IP mappings located in the file /etc/hosts. Entries in the hosts file will have precedence over DNS by default. This means that if your system tries to resolve a hostname and it matches an entry in /etc/hosts, it will not attempt to look up the record in DNS. In some configurations, especially when Internet access is not required, servers that communicate with a limited number of resources can be conveniently set to use static hostnames instead of DNS.
The following is an example of a hosts file where a number of local servers have been identified by simple hostnames, aliases and their equivalent Fully Qualified Domain Names (FQDN's).
127.0.0.1 localhost
127.0.1.1 ubuntu-server
10.0.0.11 server1 server1.example.com vpn
10.0.0.12 server2 server2.example.com mail
10.0.0.13 server3 server3.example.com www
10.0.0.14 server4 server4.example.com file
In the above example, notice that each of the servers have been given aliases in addition to their proper names and FQDN's. Server1 has been mapped to the name vpnserver2 is referred to as mailserver3 as www, and server4 as file.

Name Service Switch Configuration

The order in which your system selects a method of resolving hostnames to IP addresses is controlled by the Name Service Switch (NSS) configuration file /etc/nsswitch.conf. As mentioned in the previous section, typically static hostnames defined in the systems /etc/hosts file have precedence over names resolved from DNS. The following is an example of the line responsible for this order of hostname lookups in the file/etc/nsswitch.conf.
hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4
  • files first tries to resolve static hostnames located in /etc/hosts.
  • mdns4_minimal attempts to resolve the name using Multicast DNS.
  • [NOTFOUND=return] means that any response of notfound by the preceding mdns4_minimal process should be treated as authoritative and that the system should not try to continue hunting for an answer.
  • dns represents a legacy unicast DNS query.
  • mdns4 represents a Multicast DNS query.
To modify the order of the above mentioned name resolution methods, you can simply change the hosts: string to the value of your choosing. For example, if you prefer to use legacy Unicast DNS versus Multicast DNS, you can change the string in /etc/nsswitch.conf as shown below.
hosts:          files dns [NOTFOUND=return] mdns4_minimal mdns4

Bridging

Bridging multiple interfaces is a more advanced configuration, but is very useful in multiple scenarios. One scenario is setting up a bridge with multiple network interfaces, then using a firewall to filter traffic between two network segments. Another scenario is using bridge on a system with one interface to allow virtual machines direct access to the outside network. The following example covers the latter scenario.
Before configuring a bridge you will need to install the bridge-utils package. To install the package, in a terminal enter:
sudo apt install bridge-utils
Next, configure the bridge by editing /etc/network/interfaces:
auto lo
iface lo inet loopback

auto br0
iface br0 inet static
        address 192.168.0.10
        network 192.168.0.0
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        bridge_ports eth0
        bridge_fd 9
        bridge_hello 2
        bridge_maxage 12
        bridge_stp off
Enter the appropriate values for your physical interface and network.
Now bring up the bridge:
sudo ifup br0
The new bridge interface should now be up and running. The brctl provides useful information about the state of the bridge, controls which interfaces are part of the bridge, etc. See man brctl for more information.

How to Lookup the MX record(s) for a Domain

Windows (nslookup):

You can use nslookup in Windows to query DNS zones.  To lookup the MX records for a domain, open a command prompt:
C:\> nslookup
Default Server:  xxxxxxxxxx
Address:  xxx.xxx.xxx.xxx

> set type=mx
> example.com

Non-authoritive answer:
example.com      MX   preference = 10, mail exchanger = mail1.example.com
example.com      MX   preference = 20, mail exchanger = mail2.example.com
OSX / Linux / BSD (host):

I’ll explain how to use host in OSX and on Linux/BSD. Anyway, host is installed by default on OSX, but probably not on Linux or BSD – you may have to install it manually. (On Ubuntu and Debian, you can install it by using ‘apt-get install host‘ if it’s not already installed).

From a terminal:
$ host -t MX example.com
example.com mail is handled by 10 mail1.example.com.
example.com mail is handled by 20 mail2.example.com.
MX records are always an FQDN (Fully Qualified Domain Name, if setup properly) and have priority levels which are the 10 and 20 you see.  Priorities are important; if a mail server tries to send an e-mail to anything@thedomain, then it’ll use the LOWEST priority mail server first. If this accepts the mail, then job complete.. if it times out or the lookup of the IP address doesn’t complete, then it’ll try the next lowest priority mail server. You can also use two mail servers with the same priority level, and mail servers will just choose one when sending – useful for a bit of simple load balancing.

























Thursday, January 21, 2016

Learn Python

Never thought learning Python would be so easy !! By name it's scary to start but believe me or not; with little focus and right source even you can learn Python....

Thanks to Microsoft Virtual Academy
Find very good interactive tutorial at YouTube
https://www.youtube.com/watch?v=9uq3w6JJS00

Regarding IDE, Default Python IDE is okay but I would recommend Microsoft Visual Studio as it's much interactive and fun to learn....
With coming IOT and SDN, Python will be the key
    

Tuesday, December 22, 2015

Sunday, December 20, 2015

Data Wiping Software

DBAN is free erasure software designed for the home user. It automatically deletes the contents of any hard disk that it can detect. This method prevents identity theft before recycling a computer. DBAN is also a commonly used solution to remove viruses and spyware from Microsoft Windows installations.
  • DBAN users should be aware of some product limitations, including:
  • No guarantee of data removal (e.g. DBAN does not detect or securely erase SSDs)
  • No audit-ready reporting for regulatory compliance
  • Limited hardware support (e.g. no RAID dismantling)
  • No customer support or regular software updates
A very good Operating System for wiping out hard disk....

Check it out at below link...

Checkout this below tutorial 



    

Friday, December 18, 2015

Cisco NX-OS and Cisco IOS Comparison


  • When you first log in to NX-OS, you go directly into EXEC mode
  • NX-OS has a setup utility that enables a user to specify the system defaults, perform basic configuration, and apply a predefined Control Plane Policing (CoPP) security policy
  • NX-OS uses a feature-based license model. This enables flexibility in licensing for uses in different areas of the network in which not all features are required
  • NX-OS has the capability to enable and disable features such as OSPF, BGP, and so on via the feature configuration command. Configuration and verification commands are not available until you enable the specific feature
  • Interfaces are labeled in the configuration as Ethernet. There aren’t any speed designations in the interface name. Interface speed is dynamically learned and reflected in the appropriate show commands and interface metrics
  • Secure Shell version 2 (SSHv2) is enabled by default. (Telnet is disabled by default.)
  • The default login administrator user is predefined as admin; a password must be specified when the system is first powered up. With NX-OS, you must enter a username and password; you cannot disable the username and password login
  • The default Spanning Tree mode in NX-OS is Rapid-PVST+
  • Caution In NX-OS, you must enable features such as OSPF, BGP, and CTS (Cisco Trust Sec). If you remove a feature via the no feature command, all relevant commands related to that feature are removed from the running configuration


    

Cisco Packet Tracer 6.2 Free Download

Cisco Packet Tracer is a powerful network simulator that can be utilized in training for CCNA TM and CCNP TM certification exam by allowing students to create networks with an almost unlimited number of devices and to experience troubleshooting without having to buy real CiscoTM routers or switches. 

Cisco Packet Tracer features an array of simulated Application layer protocols (HTTP, DNS, …), as well as basic routing with RIP, OSPF, and EIGRP, to the extent required by the current CCNA TM curriculum. It also includes Cisco IOS 15 with licence features which was introduced in the CCNA exam in 2013. 

Cisco Packet Tracer 6.2 has been released in two versions by Cisco in February 2015  : "Cisco Packet Tracer Student" and "Cisco Packet Tracer Instructor". Cisco Packet Tracer 6.2 includes an ASA 5505 firewall with command line configuration (but no Adaptive Security Device Manageror CCP tools). It also includes a netflow collector as a Desktop application in the server device, routing protocols for IPv6 (OSPFv3, EIGRPv6 , RIPNg), DHCP snooping commands, IPv6 CEF, IPSEC ... 
Packet Tracer 6.2 introduced 3G/4G telephony support as well as a new Cisco 819 ISR router with a embedded wireless Access Point. OSPF and EIGRP enhancements were also added in this new version. 

Click on the below link to download
http://www.mediafire.com/download/b73vge94ng4mjm3/Cisco_Packet_Tracer_6.2_for_Windows_Student_Version_%28no_tutorials%29.rar
    

Wednesday, October 28, 2015

VMware Workstation 11.0.0 on Ubuntu Error [Solved]

Hello Guys !!

Recently I faced a serious issue,  when I installed VMware Workstation 11.0.0 on Ubuntu 14.04 and solved with the help of below link... Hope this would help you too...

http://askubuntu.com/questions/618503/unable-to-run-vmware-workstation-11-failed-to-build-vmnet

To Install VMware Workstation 11.0.0 on Ubuntu, click on below link..

http://www.linuxtechi.com/install-vmware-workstation-11-on-ubuntu-linux/

Monday, October 19, 2015

Try MAC OS (Yosemite) on VMWare

I know most of you would be waiting to get hands on MAC OS X Yosemite.. Check it out by installing on Virtual Platform,

OS X Yosemite 10.10 Final version. (Courtesy : TechReviews)
Apple Released: 16 October 2014 Version 14A389
Download Link:
OSX Yosemite 10.10 Retail VMware Image
Google Drive: http://goo.gl/lGzYpB (Full)
Google Drive: http://goo.gl/zYTJtM (3 part)
M.e.d.i.a.fire: http://goo.gl/ge6hVs
T.o.r.r.e.n.t Link: http://goo.gl/fDnjsf (Full)

Optimize Mac OS X 10.10 Yosemite Faster on VMware (Download Link)
http://youtu.be/JYegaG2sSfk

How to Install Bootloader EFI Mac OS on Vmware (Download Links)
http://youtu.be/pHEgz-Ek62c

Enabling Intel VT-X and AMD-V Virtualization in BIOS VMware
http://youtu.be/CbthSKoVF-U

Mac OS X 10.10 Yosemite on AMD Processors on VirtualBox and VMware (Niresh Version 2)
http://youtu.be/CrpOjgBFMF0

Mac OS X 10.10 Yosemite on VirtualBox and VMware With Niresh Version 2 (Download Link)
http://youtu.be/zSJP9LwDA4Y

Winrar: http://goo.gl/SUs8T1
Vmware Player: http://goo.gl/QCJ5q1
Unlock All 1.3: http://goo.gl/8CECUK

Fix Google drive limit of download: http://youtu.be/p6KnsHtu5-I
Fix Rar File Corrputed :http://youtu.be/xeHdtRdVdgA