• Telecommunications Consulting

    Telecommunications Consulting

    Consulting Services from Network Design to Project Management Read More
  • Internetworking Training Experts

    Internetworking Training Experts

    Click on Training and then Courses. Read More
  • Wireshark Experts

    Wireshark Experts

    Packet analysis expertise is critical in today's networks, and being able to use the best packet analyzer application is a skill we can help you and your team attain. Read More
  • Are you a Network Scientist?

    Are you a Network Scientist?

    Online Learning, Instructor Led in person or Web-based delivery. Check out our online school. Read More
  • Online Certification Training

    Online Certification Training

    Find out about our Network Self Certification Program for Rural Service Providers here! Read More
  • IPv6 Experts

    IPv6 Experts

    Along with other Internet regions, ARIN is out of IPv4 Addresses. Are you IPv6 fluent? Are you IPv6 ready? Read More
  • Enabling the IoT with Wireless

    Enabling the IoT with Wireless

    Without wireless, we cannot have the Internet of Things. Read More
  • MPLS Book for iPad and iPhone

    MPLS Book for iPad and iPhone

    Get Mr. Walding's book here! Read More
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

Welcome to CellStream, Inc. - Telecom Consulting and Training!

Welcome to our home on the Internet, where we can not only share information, but also interact with each other.

If you are a visitor to the site, there are a number of things to view:

Registered CellStream folks and our clients will log in using their private credentials to access projects, calendars and discussions.

Thanks for visiting! We always welcome comments and suggestions.

The CellStream Team

The following is a must have reference for Linux systems networking operations.  

We will be using the two basic commands: 'ifconfig' and 'ip'.  If you are the rtoot or administrator you should have no issues using the commands as shown.  If you do not, you may want to use 'sudo' in front of the commands shown.

View the Network Settings of all Interfaces on the System

Let's use the plain vanilla ifconfig command with no arguments in a terminal window first:

ifconfig 

linuxnet1

We see the network interfaces shown, with flags, MTU, address configuration (both IPv4 and IPv6), the MAC address, then some statistics (received and transmitted packets as well as associated errors).  When you run this command you may see more interfaces including your wlan interface.

The equivalent command using 'ip' is the 'ip addr show' command:

ip addr show

linuxnet2

View the Network Settings of a Specific Interface

To examine a specific interface, use the ifconfig with the name of the interface:

ifconfig eth0

linuxnet3

Using the ip command: 

ip addr show dev eth0

linuxnet4

You can see in the above command outputs that IPv6 addresses also exist.  You can check IPv6 by using the following command:

cat /proc/net/if_inet6

Here is the command to use ifconfig for IPv6:

ifconfig eth0 | grep "inet6 addr:"

I will try to inject IPv6 below, but there is a separate article on this here.

Enabling or Disabling a Network Interface

Using the term 'down' or 'ifdown' along with the interface name will disable the interface.  The opposite, 'up' will bring the interface back up.  The example below takes eth0 down and then brings it back up.  Note the ifconfig command is run after each to show the changes:

linuxnet5

With the ip command we use the link set command:

linuxnet6

Note the subtle differene that with the ip command you see the interface is "DOWN".

Statically Assigning an IPv4 or IPv6 Address to an Interface 

Normally your system will use DHCP (bootp) to acquire an IP address from the local DHCP server or router.  However, if you want to statically set the IP address, there are serveral ways.  Keep in mind that you may need to also set the network mask as well, so even though you can do these things one at a time, we show the methods for doing them all.

Using the ifconfig command we will use the following: 

ifconfig eth0 192.168.1.99 netmask 255.255.255.0 broadcast 192.168.1.255

linuxnet7

You can do each command one at a time as follows:

ifconfig eth0 192.168.1.99 
ifconfig eth0 netmask 255.255.255.0
ifconfig eth0 broadcast 192.168.1.255

To configure an IPv6 address using the 'ifconfig':

ifconfig eth0 inet6 add 2001:db8:1:1::1/64

Using the 'ip' command:

ip -6 addr add <ipv6address>/<prefixlength> dev eth0 

Another way to change the IPv4 address is to edit the following file: /etc/network/interfaces

We will use nano to do this (in terminal enter nano /etc/network/interfaces ):

 linuxnet8

 What we are going to do is ass the following text into the file:

# The Ethernet 0 network interface
auto eth0 iface eth0 inet static address 192.168.1.100 netmask 255.255.255.0 gateway 192.168.1.1

Your screen should look like this:

linuxnet9

Then save the file.  Check the file is as you want with the 'cat' command:

linuxnet10

OK, all looks good.  You will have to issue the following command to make the changes take effect:

/etc/init.d/networking restart

In some cases you will have to reboot.

Then the changes will be made:

linuxnet11

If you wanted to statically configure an IPv6 prefix, you can follow the same procedure with nano, except add the following lines editing to suit your needs:

# Ethernet 0 network IPv6 address
iface lo0 inet6 loopback iface eth0 inet6 static address 2001:db8:0:0::1 # replace with your static address netmask 64 gateway fe80::1 # replace with your gateway link local address

Again, you will have to restart the networking or the system to have these changes take effect.

Removing an IPv4 or IPv6 Address from a Network Interface

To remove an IPv4 address from the network interface using the 'ifconfig' command:

ifconfig eth0 del 192.168.1.100

To remove an IPv4 address from the network interface using the 'ip' command:

ip addr del <ipv4address> dev eth0

To remove an IPv6 address from the network interface using the 'ifconfig' command:

ifconfig eth0 inet6 del <ipv6address>/<prefixlength>

To remove an IPv6 address from the network interface using the 'ip' command:

ip -6 addr del <ipv6address>/<prefixlength> dev eth0

Changing the MAC Address of an Interface

Sometimes we need to spoof another MAC/machine, or just change our MAC to make it easy to filter packets if we are sniffing them.

To change the MAC address of an interface use this commend:

ifconfig eth0 hw ether DE:AD:BE:EF:CA:FE

Here is a before, a change and an after view:

linuxnet13

Enabling/Disabling Promiscuous Mode

Normal Ethernet behavior filters packets that arrive at your interface that are not destined for your MAC, a Multicast group that you belong to, or broadcast.  These packets are essentially politely dropped.  In most switched ethernet environments the ethernet switch does this also.

What if you wanted to allow any and all packets received without being filtered?  This is called promiscuous mode.  Turning it on is easy:

ifconfig eth0 promisc

Turning it off is also easy:

ifconfig eth0 -promisc

Try this and then use a packet capture (using a tool like Wireshark) to see if you notice a difference in your network.

Changing the MTU of an Interface

Normal ethernet has an MTU of 1500 bytes.  What if you want to run a network with bigger packets/frames?  First you will have to turn on 'jumbo frames' on all your switched ethernet interfaces (switches and routers).  Now you can increase the size of the MTU on the Linux system:

ifconfig eth0 mtu 2000

We have increased it to 2000 bytes above.

Want to make smaller packets/frames?  Just lower the number.  The problem here is that you will likel;y see slower throughput using smaller frames.

Checking the System Route Table

If you are a networking person, you know that every computer/system running Linux has a route table.  To display the route table use:

ip route show

linuxnet12

Another way to look at the routing table is with the 'netstat' command:

netstat -r  or  netstat -r -6

linuxnet14

 

We hope this helps as a reference for Linux networking commands to at least get you up to speed.

Comments?  Missing parts?  Let us know.

 

 

Comments powered by CComment

Our Latest Content

  • Using Ansible for Network Automation

    Ansible is a tool used to automate Server provisioning and network provisioning.  Ansible is completely free!  You can dive deep

    Read More
  • How Support Should Not Happen

    The term "Support" can be used as a noun or a verb.  To the right is the definition we found

    Read More
  • Is there a lot of QUIC in your Packet Captures?

    Have you noticed a lot of QUIC protocol in your packet captures?  I certainly have, and we had better talk

    Read More
  • Using Wireshark to Analyze QUIC Traffic

    As explained in our prior article on QUIC, you may be seeing a lot of QUIC traffic in your packet

    Read More
  • T-Shark Use in Wireless Networking

    As those who have studied our Wireless Profile (available from the Profile Repository) know, there are a number of great

    Read More
  • 1
  • 2
  • 3
  • 4

Our Most Popular Articles

  • What is the 'arp' command, and how can I use it?

    ARP stands for Address Resolution Protocol.  This protocol is used by network nodes to match IP addresses to MAC addresses. 

    Read More
  • How do I reset my "Default" profile in Wireshark?

    This is a commonly asked question that usually results from users learning the can have different profiles after they have

    Read More
  • Neighbor Discovery (ND) Table in IPv6 Windows, Linux and MAC Machines

    A great question I was asked in class was: "If Neighbor Discovery processes have replaced ARP in ICMPv6, how do

    Read More
  • IPv6 Windows Command Line Examples

    Here are some great Windows command line entries you can make to examine and configure IPv6 (assuming your version of

    Read More
  • A List of Network Monitoring Tools for Network and System Administrators

    Monitoring, analyzing, and diagraming a network can often be a huge problem for Network and System Administrators.  They are often

    Read More
  • 1
  • 2
  • 3
  • 4

Subscribe to our Newsletter!

Our Tag Cloud

4G Networks 6LoWLAN 6LoWPAN 802.11 802.11ah 802.11ax 802.11ay 802.11az Ad-Hoc Addressing Airlines Analysis Ansible Apple Architecture ARP Assessment ATM AToM Automation Bandwidth BGP Billing Bloom's Taxonomy Bluehost BPF Briefings Cable Capture Filter CellStream Cellular Central Office Cheat Sheet Chrome Cisco Click Model Cloud Company Policy Computer Consulting Data Center Data Networking Decryption Dependencies DHCPv6 dig Display Filter DNS Documentation Earth Earthquakes Ethernet Ethics Etiquette Evaluation Filter Five Monkey Rule G-MPLS Gauge GNS3 Google Hands-On Hiring History Home Network HTTPS ICMP ICMPv6 IEEE 802.11p IEEE 802.15.4 India Internet IoT IPv4 IPv6 IRINN IS-IS L2VPN L3VPN LDP LifeNet Linux LLN LoL M-BGP MAC Macro Management mergecap Microsoft Milky Way mininet Monitoring MPLS Multicast Murphy Netcat NetMon netsh Networking News nmap NMS nslookup Observations OLPC Online School OpenFlow OSPF OSPFv2 OSPFv3 OSX OTT Personnel Policy POTS POTS to Pipes PPP Privacy Profile Project Management PW3E QoS QUIC Railroad Remote Desktop Requirements Review RIP Routig Routing RPL RSVP Rural Scanning SDN Security Service Provider Small Business SONET Spam Speed SS7 SSL Status Storms Subnetting Support T-Shark TCP TCP/IP Telco Telecom 101 Telecommunications Telephone TLS Tools Traffic Engineering Training TRANSUM Travel Tunnel Ubuntu Utility Video Virtualization VoIP VRF Wi-Fi Windows Wireless Wireless 5G Wireshark WLAN ZigBee

Our Twitter Feed

SiteLock