Configure network card.

If the pc is network server, check if the ip_forward is enabled with the command:

cat > /proc/sys/net/ipv4/ip_forward
(0) mean not enabled, to enable open the file /etc/sysctl.conf and enable the line:
net.ipv4.ip_forward = 1
Enable the nat and masquerade in the iptables with this iptable rules:
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -A FORWARD -i ppp0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth0 -o ppp0 -j ACCEPT
Ubuntu has gui network manager name NetworkManager that gets the ip from dhcp of router, the configuration files are in the /etc/NetworkManager directory, for more details read the man type in terminal:
man NetworkManager
The command line network manager files are in the /etc/network, to get the address form dhcp server open the file /etc/Network/interfaces and write these lines, replace the eth0 with the network card name:
# The loopback network interface
auto lo
iface lo inet loopback
# confgiure the eth0 for dhcp
auto eth0
iface eth0 inet dhcp
To list the network interfaces card names run the command:
ls /sys/class/net
For the static ip address add these lines to the file /etc/network/interfaces:
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.10
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
For these new settings to take effect you need to restart networking services using the following command:
sudo /etc/init.d/networking restart
Connecting with router to the internet
If the pc is connected with a wireless or other router, the pc is connecting to the outside internet through the router gateway, in this case your pc nameserver should be the router ip address witch in must cases it is 168.192.1.1, but in each new network connection or reboot of pc the file /etc/resolv.conf is override, to add the above nameserver to the /etc/resolv.conf, install the resolvconf package, witch will update the resolv.conf file in each network connection or reboot.
Add the nameserver to the /etc/resolvconf/resolv.conf.d/head file:
nameserver 192.168.1.1
Setting Your Hostname
The hostname command allows you to directly query, or set, the hostname from the command line.
You can see your current hostname with:
sudo /bin/hostname
To set the hostname directly you can become root and run:
sudo /bin/hostname newname
When your system boots it will automatically read the hostname from the file /etc/hostname.
mount network drives
Mount the network drives with NFS, samba and sshd to mount in a dir tmp:
sshfs 192.168.1.102:/root tmp
fusermount -u tmp (umount the dir)
mount -t ntfs 192.168.1.102:/home/user tmp
Connect with ssh:
ssh 192.168.1.102
To copy the files to [email protected]:/store/base directory, open the file dir and run the command:
scp * [email protected]:/store/base/


<< Previous Next >>