Adminbuntu

Everything for the Ubuntu Server Administrator

User Tools

Site Tools


Sidebar

Server Administration


Server Applications


At the Command Line


Elsewhere


Copyright 2013 Applied Conscious Technologies, LLC

Terms of Agreement

Contact


submit to reddit

network

Server Administration

Ubuntu Server Network Administration

Network Administration Tools for an Ubuntu Server

See Networking for general networking commands.

see also: Rsync, SSH, Wget

Network Information

Get the Server's IP Address

ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'

On an EC2 instance, this will display the server's world facing IP address:

curl -s ip.appspot.com

Lookup Whois Info

List ownership information for a URL or IP address.

Install Whois

sudo aptitude -y install whois

Using Whois

whois websitename.com

Ping vs Traceroute

The ping command can be used to check whether a server is accessible.

The traceroute command analyzes the connection to a server, listing the hops and hop times required to connect.

Ping will simply check for accessibility and traceroute also lists hops and times.

Using Ping

ping servername

Using Traceroute

traceroute servername

Pinging an AWS EC2 Instance

Ping uses ICMP ECHO, which by default is blocked by the firewall on an EC2 instance. You can use traceroute instead.

To enable ping, grant ICMP access by updating the firewall restrictions that are tied to your security group.

First, Install EC2 API Tools.

sudo ec2-authorize default -P icmp -t -1:-1 -s 0.0.0.0/0

List Internet Services on the Server

This will list the web services that you server offers.

netstat -tupl

List Active Connections to/from System

Who or what is connected to the server right now?

netstat -tup

List Active Incoming Connections

netstat -an | grep -i tcp | grep ESTABLISHED

Get Ethernet Adapter Driver and Firmware Information, Including Versions

If ethtool is not installed, install it with:

sudo aptitude -y install ethtool
ethtool -i eth0

Get an IP for a Domain

This will return an IP number for a given URL.

dig +short www.sitename.com

Ethernet

Show Status of Ethernet Interface eth0

ethtool eth0

Manually Set Ethernet Interface Speed

ethtool --change eth0 autoneg off speed 100 duplex full

Show Status of Wireless Interface eth1

iwconfig eth1

Manually Set Wireless Interface Speed

iwconfig eth1 rate 1Mb/s fixed

List Wireless Networks in Range

iwlist scan

Network Interface

List Network Interfaces

ip link show

Bring Interface eth0 Up (or Down)

ip link set dev eth0 up

Rename Interface eth0 to wan

ip link set dev eth0 name wan

List Addresses for Interfaces

ip addr show

Add (or Delete) IP and Mask (255.255.255.0)

ip addr add 1.2.3.4/24 brd + dev eth0

List Routing Table

ip route show

Set Default Gateway to 1.2.3.254

ip route add default via 1.2.3.254

Add 20ms Latency to Loopback Device (for Testing)

tc qdisc add dev lo root handle 1:0 netem delay 20msec

Remove Latency Added Above

tc qdisc del dev lo root

Lookup DNS IP Address for Name or Vice Versa

host websitename.com

Lookup a Local IP Address

hostname -i

Web

Show the HTTP Status Code for a URL

This returns just the numeric HTTP response code.

curl -sL -w "%{http_code} \\n" "http://www.sitename.com/api/something/7039/" -o /dev/null

network.txt · Last modified: 2015/05/31 21:20 (external edit)