|
|
| (18 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| =networking= | | =Basic Networking= |
|
| |
|
| ==ping==
| | This page covers some basic troubleshooting for Linux networks. See [[Template:LinuxNetworkingFlag]] for more pages like this one. |
|
| |
|
| Okay, you have managed to run ping. You have even figured out how to use the <code>-c</code> flag. In this case, ping will attempt four times, stop, and then report some basic statistics to you.
| | Linux network interfaces: [[Linux/Network Interfaces]] |
|
| |
|
| 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?
| | Linux network services: [[Linux/Networking Services]] |
|
| |
|
| First, let's explore how to check our current configuration. In Debian, the file that controls the network devices by default is the following:
| | =Open Ports= |
|
| |
|
| <pre>
| | List open ports: |
| /etc/network/interfaces
| |
| </pre>
| |
| | |
| 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:
| |
| | |
| <pre>
| |
| # vim /etc/network/interfaces
| |
| </pre>
| |
| | |
| ==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>
| |
| $ cat /etc/network/interfaces
| |
| | |
| # The loopback network interface
| |
| auto lo
| |
| iface lo inet loopback
| |
| </pre>
| |
| | |
| check for network manager
| |
| | |
| <pre>
| |
| $ ps ax | grep NetworkManager
| |
| </pre>
| |
| | |
| kill it! kill it!!!
| |
| | |
| <pre>
| |
| 446 ? Ssl 0:00 /usr/sbin/NetworkManager --no-daemon
| |
| </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> |
| # The loopback network interface
| | netstat -lntu |
| auto lo
| |
| iface lo inet loopback
| |
| | |
| # Wired connection eth0
| |
| auto eth0
| |
| iface eth0 inet dhcp
| |
| </pre> | | </pre> |
|
| |
|
| ==manual static== | | =Related= |
|
| |
|
| <pre>
| | See [[Template:LinuxNetworkingFlag]] for more pages like this one. |
| # 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
| |
| </pre>
| |
|
| |
|
| the following line changed:
| |
|
| |
|
| <pre>
| |
| iface eth0 inet static
| |
| </pre>
| |
|
| |
| 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
| |
|
| |
| <pre>
| |
| $ systemctl restart networking.service
| |
|
| |
| or
| |
|
| |
| $ service networking restart
| |
| </pre>
| |
|
| |
| figure out what networking interfaces are available
| |
|
| |
| <pre>
| |
| $ ifconfig
| |
|
| |
| or
| |
|
| |
| $ ip addr show
| |
| </pre>
| |
|
| |
|
| {{KaliFlag}} | | {{LinuxNetworkFlag}} |
| {{NetworkingFlag}}
| |