User Tools

Site Tools


linux:general:network

Network

Ports

PortProtocol
20 + 21 FTP
22 SSH
25 SMTP
80 HTTP
111 + 2049 TCP/UDP - NFS
123
137 + 139 + 445 TCP/UDP - SMB/Samba
443 HTTPS
8080 Proxy
3389 RDP
3306 MySQL

Configuration

Proxy

For your account only edit:

sudo vi /home/<username>/.bashrc


For global proxy edit:

sudo vi /etc/profile

add

export http_proxy=http://10.0.0.1:8080
export https_proxy=https://10.0.0.1:8080


Reload your configuration

source /home/<username>/.bashrc

or

source /etc/profile

Set proxy for apt

Open apt.conf

vi /etc/apt/apt.conf

Set proxy

Acquire::http::Proxy "http://127.0.0.1:8080";
Acquire::https::Proxy "https://127.0.0.1:8080";

Set proxy for wget

Open wgetrc

vi ~/.wgetrc

Set proxy

use_proxy=on
http_proxy=127.0.0.1:8080
https_proxy=127.0.0.1:8080
http_proxy=http://username:password@proxy_host:proxy_port
https_proxy=https://username:password@proxy_host:proxy_port

OR

wget <URL> -e use_proxy=on -e http_proxy=127.0.0.1:8080

Change your IP (Ubuntu)

Edit /etc/network/interfaces:

sudo vi /etc/network/interfaces

and add

auto eth0
iface eth0 inet static
        address 10.0.0.2
        netmask 255.0.0.0
        network 10.0.0.0
        broadcast 10.0.0.255
        gateway 10.0.0.1
        dns-nameservers 10.0.0.1

Restart your networkinterface

/etc/init.d/networking restart
ifdown eth0 && ifup eth0

Change your IP (SLES11/12)

Edit /etc/sysconfig/network/ifcfg-eth0:

sudo vi /etc/sysconfig/network/ifcfg-eth0

and add

DEVICE='eth0'
BOOTPROTO='static'
STARTMODE='auto'
USERCONTROL='no'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='10.0.0.2'
MTU=''
NAME=''
NETMASK='255.255.255.0'
NETWORK=''
REMOTE_IPADDR=''

Edit gateway /etc/sysconfig/network/routes:

sudo vi /etc/sysconfig/network/routes

and add

default 10.0.0.1 - eth0
#default 10.0.0.1 - -

Restart your networkinterface

SLES11

/etc/init.d/networking restart

SLES12

ifdown eth0 && ifup eth0

Join a domain and change hostname

Edit /etc/hosts

sudo vi /etc/hosts

and add

127.0.0.1       localhost.localdomain localhost
127.0.1.1       ubuntu.lunetikk.de ubuntu
10.0.0.2        ubuntu.lunetikk.de ubuntu



Open /etc/hostname and change the entry to your new hostname (for example: ubuntu)

sudo vi /etc/hostname

Reload your hostname

hostname –F /etc/hostname

Tools to monitor traffic

Askubuntu - Tools to display traffic

#bmon - shows multiple interfaces at once
apt-get install bmon

#tcptrack - Tells how much bandwidth is being used and also what protocol (service/port) and destination the transmission is taking place to. Very helpful when you want to know exactly what is using up your bandwidth
apt-get install tcptrack

#nload - Separated view for down and upload
apt-get install nload

#iftop
apt-get install iftop

#ethstatus
apt-get install ethstatus

bmon:

tcptrack:

nload:

iftop:

ethstatus:

Troubleshooting

resolv.conf is empty

 dpkg-reconfigure resolvconf 

Cant do ifdown/ifup

# ifdown eth0 && ifup eth0
/etc/resolvconf/update-libc.d/sendmail: 7: .: Can't open /usr/share/sendmail/dynamic
run-parts: /etc/resolvconf/update-libc.d/sendmail exited with return code 2
run-parts: /etc/resolvconf/update.d/libc exited with return code 1
/etc/resolvconf/update-libc.d/sendmail: 7: .: Can't open /usr/share/sendmail/dynamic
run-parts: /etc/resolvconf/update-libc.d/sendmail exited with return code 2
run-parts: /etc/resolvconf/update.d/libc exited with return code 1
/etc/network/if-up.d/sendmail: 44: .: Can't open /usr/share/sendmail/dynamic
run-parts: /etc/network/if-up.d/sendmail exited with return code 2

This should fix it:

 apt-get --purge remove sendmail sendmail-base sendmail-bin 



linux/general/network.txt · Last modified: 2019/04/16 14:21 by lunetikk