Linux/Networking: Difference between revisions
From charlesreid1
| Line 23: | Line 23: | ||
==continuing== | ==continuing== | ||
<code>/etc/network/interfaces</code> | |||
file is not required for network hardware to work - it is optional. if nothing is set in the above file, network is probably being managed by network manager. system level daemon that makes things "just work". | |||
desktops/laptops usually want network manager, servers/embedded computers/etc want stuff configured in <code>/etc/network/interfaces</code> | |||
barebones interfaces file: | |||
<pre> | <pre> | ||
| Line 39: | Line 39: | ||
</pre> | </pre> | ||
check for network manager | |||
<pre> | <pre> | ||
| Line 45: | Line 45: | ||
</pre> | </pre> | ||
kill it! kill it!!! | |||
<pre> | <pre> | ||
| Line 51: | Line 51: | ||
</pre> | </pre> | ||
die die die - ok back to what we were doing. | |||
to add ethernet hardware, and let it autoconfigure using a dhcp server (i.e., you'll be plugging it into a router or other device running a dhcp server that will hand out ip addresses) | |||
<pre> | <pre> | ||
| Line 62: | Line 64: | ||
iface eth0 inet dhcp | iface eth0 inet dhcp | ||
</pre> | </pre> | ||
==manual static== | ==manual static== | ||
Revision as of 05:35, 13 March 2016
networking
ping
Okay, you have managed to run ping. You have even figured out how to use the -c flag. In this case, ping will attempt four times, stop, and then report some basic statistics to you.
Knowing how to check whether or not you're connected is one thing, but what do you do when you're not? Or what if your network connection is active, but reports invalid information and you need to reconfigure it?
First, let's explore how to check our current configuration. In Debian, the file that controls the network devices by default is the following:
/etc/network/interfaces
Depending on several variables, which include how you configured your Debian installation, this file may be created differently. First, you may see several interfaces listed, such as your loopback adapter, wired Ethernet, and wireless. If you have more than one wired interface, you'll see any additional adapters here as well. This file is, simply put, a configuration file. It's a text file that contains information that the underlying Linux system understands, and causes a device to be configured as designated in the file.
To edit files such as these, there are many Linux text editors available, both GUI and terminal based. My personal favorite is vim, though many administrators typically start off with nano. The nano text editor is fairly easy to use, though very light on features. Alternatively, vim has many more features than nano but is a bit harder to get used to. Take your pick. To open a file in nano, all you need to do is type nano along with the name of a text file you would like to edit. If the file doesn't exist, the command will create it if you save the file. In the case of our /etc/network/interfaces file, the command will be similar to this:
# vim /etc/network/interfaces
continuing
/etc/network/interfaces
file is not required for network hardware to work - it is optional. if nothing is set in the above file, network is probably being managed by network manager. system level daemon that makes things "just work".
desktops/laptops usually want network manager, servers/embedded computers/etc want stuff configured in /etc/network/interfaces
barebones interfaces file:
$ cat /etc/network/interfaces # The loopback network interface auto lo iface lo inet loopback
check for network manager
$ ps ax | grep NetworkManager
kill it! kill it!!!
446 ? Ssl 0:00 /usr/sbin/NetworkManager --no-daemon
die die die - ok back to what we were doing.
to add ethernet hardware, and let it autoconfigure using a dhcp server (i.e., you'll be plugging it into a router or other device running a dhcp server that will hand out ip addresses)
# The loopback network interface auto lo iface lo inet loopback # Wired connection eth0 auto eth0 iface eth0 inet dhcp
manual static
# The loopback network interface
auto lo
iface lo inet loopback
# Wired connection eth0
auto eth0
iface eth0 inet static
address 10.10.10.12
netmask 255.255.248.0
network 10.10.10.0
broadcast 10.10.10.255
gateway 10.10.10.1
the following line changed:
iface eth0 inet static
static, not dhcp
if you declare dhcp, all other configuration details ignored
next declare ip address, 10.10.10.12
declare subnet mask to 255.255.248.0
declare the network we're joining to 10.10.10.0
declare the broadcast ID as 10.10.10.255
decalre the gateway as 10.10.10.1
now restart networking service
$ systemctl restart networking.service or $ service networking restart
figure out what networking interfaces are available
$ ifconfig or $ ip addr show
| Networking pages and notes about computer networks.
Man in the Middle attack vectors on wired networks: Man in the Middle/Wired Packet analysis with Wireshark: Wireshark Packet Analysis Linux networking: Linux/Networking
Using Aircrack: Aircrack Many Ways to Crack a Wifi: Cracking Wifi
Linux/Networking · Linux/SSH · Linux/File Server
Notes on OpenVPN: OpenVPN Setting Up a Static Key VPN: OpenVPN/Static Key
Domain Name Servers: DNS · Linux/DNS IP Version 6: IPv6
Wireshark · SSH · Stunnel · Tor · Ettercap · Aircrack · Tcpdump
Tunnels · HTTP and HTTPS · SSH Tunnels · Linux/SSH
|