≡ Menu

interface name

Debian Linux Configure Wireless Networking With WPA2

I‘ve Atheros AR5001 wifi a/b/g card detected and supported natively under Linux. How do I configure my wireless card with WPA2 networking using /etc/network/interfaces file?
[click to continue…]

Sysadmin because even developers need heroes!!!

HowTo: Linux Send a Gratuitous ARPs Requests [ Networking ]

How do I send gratuitous ARPs under Linux? How do I tell my DUMMY router that the IP is over here now, under Linux operating systems?
[click to continue…]

Iptables Drop IP Address

How do I block particular IP addresses or host with the iptables command under Linux?
[click to continue…]

Linux iptables: Port Redirection Example

How do I redirect 80 port to 8123 using iptables?
[click to continue…]

Iptables: Invert IP, Protocol, Or Interface Test With !

How do I invert a protocol or ip address test while writing iptables based shell scripts?
[click to continue…]

Linux Iptables: Add / Delete An IP Address Remotely Using A Shell Script

I’ve root ssh access and need to add / delete a few IP address on fly using the IPtables command via local shell script. How do I add or delete an IP address remotely over the SSH session under CentOS / Redhat / RHEL / Debian / Ubuntu Linux?
[click to continue…]

Router ARP Cache is Not Releasing Linux / UNIX Server IP address

Q. Recently we made changes to our server hardware and swapped all IP address from old to a new server. However, 2 IP addresses are not get updated due to arp cache issues (IPs are cached on the router). They are going to other servers. How do I solve this problem under Redhat Enterprise Linux version 5.0 or any other Linux distribution?
[click to continue…]

Linux Firewall: Display Status and Rules of Iptables Firewall

Q. How do I display / list all rules in the selected chain? How do I find out which rules are active? What is blocked and opened with my firewall?

A. To List all rules in the selected chain use the -L option. If no chain is selected, all chains are listed. As every other iptables command, it applies to the specified table. The -n option help to print IP addresses and port numbers in numeric format.

To check the status of your firewall and all rules, enter:
# iptables -L -n
OR
$ sudo iptables -L -n
Output:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
droplist   all  --  0.0.0.0/0            0.0.0.0/0           
droplist   all  --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     all  --  66.228.118.0/23      0.0.0.0/0           
DROP       all  --  213.240.4.233        0.0.0.0/0           
DROP       all  --  75.126.132.23        0.0.0.0/0           
DROP       all  --  80.58.205.35         0.0.0.0/0    
.....
...
.....
DROP       all  --  91.200.56.0/22       0.0.0.0/0           
LOG        all  --  91.200.72.0/22       0.0.0.0/0           LOG flags 0 level 4 prefix `DROP List Block' 
DROP       all  --  91.200.72.0/22       0.0.0.0/0           

The –line-numbers option adds line numbers to the beginning of each rule, corresponding to that rule’s position in the chain. The -v option makes the list command show the interface name, the rule options (if any), and the TOS masks. The packet and byte counters are also listed, with the suffix K, M or G for 1000, 1,000,000 and 1,000,000,000 multipliers respectively (but see the -x flag to change this).
# iptables -L -v -n --line-numbers

Find subnet mask on UNIX

Q. How do I find out subnet mask on UNIX operating system? Can you tell us the name of command and configuration file to store subnetmask under UNIX?

A. A subnetwork/ subnet is a range of logical addresses within the address space that is assigned to an organization. Subnetting is a hierarchical partitioning of the network address space of an organization (and of the network nodes of an autonomous system) into several subnets. Routers constitute borders between subnets. Communication to and from a subnet is mediated by one specific port of one specific router, at least momentarily.

Under UNIX / Linux, you need to use the ifconfig utility to assign an address to a network interface
and/or configure network interface parameters. Same command can display subnet. Just type command ifconfig:
$ ifconfig
OR
$ /sbin/ifconfig
OR
$ /sbin/ifconfig interface-name

lnc0: flags=108843 mtu 1500
        inet 72.122.61.51 netmask 0xfffffff8 broadcast 72.122.61.55
        ether 00:0c:29:32:8a:8c
plip0: flags=108810 mtu 1500
lo0: flags=8049 mtu 16384
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
        inet6 ::1 prefixlen 128 
        inet 127.0.0.1 netmask 0xff000000 

Look for inet line you will see an IP address, followed by netmask.