See which ports are open, as an attacker would:
nmap 127.0.0.1
(Superuser seems to need to be used on some the following commands)
See which process is using port 25:
netstat -nlp | grep 25
Same, with a bit less info:
fuser -n tcp 25
Or you could also do:
fuser -u smtp/tcp
Discovered here
Showing posts with label networking. Show all posts
Showing posts with label networking. Show all posts
Saturday, April 10, 2010
Thursday, December 21, 2006
Static IPs in Debian-based Linux
Here's a brief overview of how to set up an internet connection using a static IP address on Debian-based Linux systems. Most large networks nowadays use DHCP to get a user an IP address, but knowledge of static IP configuration can still be helpful in a lot of situations. First, edit the /etc/network/interfaces file as a superuser so that the entry for the desired interface looks something like this (replace x's with numeric values):
iface eth0 inet static # static, as opposed to dhcp... replace eth0 with desired interface
address xxx.xxx.xxx.xxx # ip address you want assigned to this computer
netmask xxx.xxx.xxx.xxx # subnet mask
network xxx.xxx.xxx.xxx # optional
broadcast xxx.xxx.xxx.xxx # optional
gateway xxx.xxx.xxx.xxx # gateway (usually router/firewall) ip address
Once you have done this, restart your network interfaces with
The gateway can also be specified on the command line if it's not in the interfaces file: sudo route add default gw xxx.xxx.xxx.xxx The command netstat -nr can show the routes, including gateways, that the kernel is currently using.
To explicitly release a dhcp connection, do something like dhclient -r eth0
If your computer and network is set up correctly, you should now be able to ping your gateway and access sites on the internet by IP address. However, in order to access sites by name you need the help of DNS. Add entries to the /etc/resolv.conf file as a superuser in this format (you can have as many as you want):
nameserver xxx.xxx.xxx.xxx
Now, if you point your browser to a domain name like www.yahoo.com, you should be able to get there. Welcome to t3h 1nt3rw3b. You can also do all the above by accessing the System->Administration->Network menu.
Links:
For switching from one interface configuration to another (assuming eth0 and correct /etc/network/interfaces):
iface eth0 inet static # static, as opposed to dhcp... replace eth0 with desired interface
address xxx.xxx.xxx.xxx # ip address you want assigned to this computer
netmask xxx.xxx.xxx.xxx # subnet mask
network xxx.xxx.xxx.xxx # optional
broadcast xxx.xxx.xxx.xxx # optional
gateway xxx.xxx.xxx.xxx # gateway (usually router/firewall) ip address
Once you have done this, restart your network interfaces with
sudo /etc/init.d/networking restartThe gateway can also be specified on the command line if it's not in the interfaces file: sudo route add default gw xxx.xxx.xxx.xxx The command netstat -nr can show the routes, including gateways, that the kernel is currently using.
To explicitly release a dhcp connection, do something like dhclient -r eth0
If your computer and network is set up correctly, you should now be able to ping your gateway and access sites on the internet by IP address. However, in order to access sites by name you need the help of DNS. Add entries to the /etc/resolv.conf file as a superuser in this format (you can have as many as you want):
nameserver xxx.xxx.xxx.xxx
Now, if you point your browser to a domain name like www.yahoo.com, you should be able to get there. Welcome to t3h 1nt3rw3b. You can also do all the above by accessing the System->Administration->Network menu.
Links:
- HOWTO Basic Network Troubleshooting An Ubuntu Forums post about basic networking... check out the great script towards the bottom of the first page
- HOWTO Ubuntu Linux convert DHCP network to static IP Explains how to do this, and much more, on the command line
- Ubuntu Networking for Basic and Advanced Users A visual guide to using the Ubuntu Networking GUI
- SearchNetworking.com A good, general-purpose networking resource
For switching from one interface configuration to another (assuming eth0 and correct /etc/network/interfaces):
- sudo ifdown eth0
- edit /etc/network/interfaces
- sudo ifup eth0
Subscribe to:
Posts (Atom)