The above example sets the MTU for device eth0 to 1492, the usual MTU for a PPPoE ISP connection. You can set the MTU for an interface, you could do this by using the mtu keyword in the interface file or by using the ip link command. If you need to set up a second ip address you need to edit the /etc/network/interfaces.įor these new settings to take effect you need to restart networking services using the following command sudo /etc/init.d/networking restart Setting up a second IP address or Virtual IP address sudo vi /etc/network/interfacesįor these settings to take effect you need to restart your networking services. To configure a interface permanently you'll need to edit the interfaces file, /etc/network/interfaces. This is where the interfaces file comes in handy. These commands configure your interface but these changes will not survive a reboot, since the information is not stored anyhwere. Sudo ip route add default via 192.168.1.1
And your IP should be in the same range as the router is. If you don't have DHCP enabled configure your network by issueing the commands below, the gateway address is the IP address of your router. Your network is now configured (for the time being). This will bring your eth0 up by using DHCP. Connect via a regular UTP cable to your router, and assuming you have DHCP enabled do the following: If you have disabled the either wicd or the network manager you probably don't have a network connection anymore. We will use eth0 in this example, your interface can be named differently, see Finding your network interface. Thus if the first command above does not stop Network Manager, try this. Note: At some point Ubuntu started using upstart instead of the /sbin/init/ daemon. # Reverse: sudo update-rc.d -f wicd defaults 20 # Reverse: sudo chmod +x /etc/init.d/wicd
# Reverse: sudo aptitude install network-manager # Reverse: sudo update-rc.d -f NetworkManager defaults 50 Sudo update-rc.d -f NetworkManager remove # Reverse: sudo chmod +x /etc/init.d/NetworkManager # Start: sudo /etc/init.d/NetworkManager start Be aware that the rest of this guide will require packages which need to be installed from the online repositories. To counter this, disable the startup script of either application or completely remove the packages. It will probably include eth0 (hardwired NIC), lo (loopback interface for the localhost), and something for your wireless card (like wifi0, or wlan0).Ĭonfiguring your network via the CLI will likely interfere with Network Manager or wicd.
This will list the interface names for all NICs on your computer. The interface name of cards for different vendors may be different, which is why this step is needed. When setting up your network you will need to know the network interface cards on your computer. You can add hostname and IP addresses to the file /etc/hosts for static lookups. When your system boots it will automatically read the hostname from the file /etc/hostname. To circumvent this you need to add the new name to the hosts file prior to setting the hostname and remove it once that action has succeeded. This is because sudo requires DNS lookups in certain cases and it cannot resolve your newly set hostname. This is needed because otherwise you will need to boot into single user mode and change your hostname in /etc/hosts. If you do this however, make sure you change the /etc/hosts file first. To set the hostname directly you can run hostname newname as root. You can see your current hostname by running hostname. The hostname command allows you to directly query, or set, the hostname from the command line.
Read this guide in full before actually configuring your network. Just easier to recover when you have a backup. We need to install packages and those are fetched from the online repositories.īackup any files we touch. Have a working internet connection during the installation. This guide will use vi, but you can replace it with any other editor of your liking, gedit, nano, gvim, pico, emacs. This guide had been developed for Ubuntu and Debian, other distributions can use a similar setup, but be aware that file locations may differ.Īn editor. This has several advantages over network managers in the GUI. You can configure your network client hosts with the command line by using commands to change your current settings or by editing a number of system files. You can configure a network interface from the command line.