Fun at work!

Archive for April, 2014

Link

Repost: Red5 Server RTMPT with Apache as Webserver and Flowplayer Configuration

Repost: Red5 Server RTMPT with Apache as Webserver and Flowplayer Configuration

Link

Repost: Find Out What Ports Are Listening

Repost: Find Out What Ports Are Listening

How do I find open ports on Linux / FreeBSD server?

There are different commands on both Linux and UNIX server to find out what tcp/udp ports are listening or open on your own server. You can use netstat command, which print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships etc. Another (and suggested) option is to use lsof command, which list open files, and ports on Linux, FreeBSD, Solaris and other Unixish systems.

netstat command to find open ports

# netstat --listen
To display open ports and established TCP connections, enter:
$ netstat -vatn
To display only open UDP ports try the following command:
$ netstat -vaun
If you want to see FQDN (full dns hostname), try removing the -n flag:
$ netstat -vat

lsof Command Examples

To display the list of open ports, enter:
# lsof -i
To display all open files, use:
# lsof
To display all open IPv4 network files in use by the process whose PID is 9255, use:
# lsof -i 4 -a -p 9255

A Note About FreeBSD Users

You can use the sockstat command lists open Internet or UNIX domain sockets, enter:
$ sockstat
$ sockstat -l
$ sockstat -4 -l
$ sockstat -6 -l

Link

Repost: “Local DNS Settings: Map a Domain to a Local IP Address”

Repost: “Local DNS Settings: Map a Domain to a Local IP Address”

Edit the Hosts File in Windows

1. Open the Hosts file in Notebook or some other simple text editor editor. Where is the hosts file you ask? Depends on your setup, but for most Windows systems the directory path should be something like

\\Windows\System32\drivers\etc\hosts

Depending on your security settings, you may need to open your text editor in administrator mode (‘run as administrator’) in order to save your edits.

2. At the top of the file there are instructions for how to use the file, all preceeded by the # comment tags.

3. Below this are the actual mappings. The first column contains the preferred IP destination, while the second column contains the domain to be mapped. The domains in the second column will resolve to the corresponding IPs in the first column. A few important points:

  • Naked domains and subdomains (i.e., www.) must be mapped separately.
  • You must use an IP address in the first column, not another domain name.
  • Use hashes to disable mappings temporarily

4. Once you’ve made your settings, save the file.

5. Open the Command Prompt and update your system’s DNS cache with the command:

ipconfig /flushdns

6. All browsers should now follow these mappings for the domains listed in this Hosts file.

Edit the Hosts File on a Mac OSX

1. Open Terminal and open the hosts file using the following command:

sudo nano /private/etc/hosts 

2. You may be asked to enter your administrator password. Go ahead and do that to continue.

3. The Hosts file will open. Much like the Windows version, there are instruction comments at the top, followed by the mappings. The first column contains the preferred IP destination, while the second column contains the domain to be mapped. The domains in the second column will resolve to the corresponding IPs in the first column.

4. Add your new mappings. Just as with the Windows version, keep in mind that:

  • Naked domains and subdomains (i.e., www.) must be mapped separately.
  • You must use an IP address in the first column, not another domain name.
  • Use hashes to disable mappings temporarily

5. When finished save your changes by pressing Control-o, then hit return to confirm the filename, then Control-x to close the Hosts file.

6. Lastly, update your DNS cache from Terminal using the command:

dscacheutil -flushcache

7. All browsers should now follow these mappings for the domains listed in this Hosts file.