For your case, network is 192.168.1.0
, which means
your ip address is in the network range, 192.168.1.0 to
192.168.1.255
You can always get your network base address easily by doing
ip & mask
, where &
is logical AND.
ip [ OPTIONS ] OBJECT { COMMAND | help }
OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable | tunnel | tuntap | maddr | mroute | mrule | monitor | xfrm | netns | l2tp | tcp_metrics }
OPTIONS := { -V[ersion] | -s[tatistics] | -r[esolve] | -f[amily] { inet | inet6 | ipx | dnet | link } | -o[neline] }
Step 2
For your case, network is 192.168.1.0
, which means
your ip address is in the network range, 192.168.1.0 to
192.168.1.255
You can always get your network base address easily by doing
ip & mask
, where &
is logical AND.
Simple answer: On Linux ifconfig
is obsolete.
From man ifconfig
:
This program is obsolete! For replacement check
ip addr
andip link
. For statistics useip -s link
.
In windows this would be "arp -a
" I believe that an
equivalent of that in Linux would be "arp -e
".
This information can be found from the man page for arp :
arp with no mode specifier will print the current content of the table.
-e : Use default Linux style output format (with fixed columns).
I am not sure if I understand correctly. But you have 1 Wireless gateway and 3 Devices connected to it?
So doing ifconfig only shows PHYSICAL hardware/connections on the PC that ran the command - not the connections available or other device.
ifconfig stands for interface configuration
An interface if a virtual or physical layer on the computer that enables it to communicate with other devices using a standard, for example in your case TCP/IP
eth0
could be your Wired Network card running at
10/100/1000
eth1
is possibly your wirless interface running at
a/b/g/n speeds.
lo
is a virtual interface and is called a loopback
and bind to your computer using home (127.0.0.1) or (localhost)
or whatever your computers name is(because it loops back to it
self)
To see other computers you need to use something like ARP and to find other computers or devices within your network range.
Also as suggested you can use a wireless tool iwconfig to scan for access points (an access point is not an interface- but the access point it self uses an interface to communicates with other devices found in ARP)
And you only have 1 internet connection, not 3.
In total you should have 5 ARP entries - 2 PC's, 1Notebook, 1Switch and 1 Modem
So as you can see in the illustration, each host has an interface of eth0, the gateway has eth0 and the ISP on the other side has eth0. the more interfaces a device has the higher the number.
You must use the route command. For example if you want to route all ip of 192.168.1.xxx to a particular device you have to use the following command:
route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0
With that command you say that all the packets sent from that subnet must be sent to the eth0 interface. If you need to add also a gateway for that connection you can use that:
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1
More than you could ever possibly need. Use ip addr
add
to add addresses to an interface.
rc.local is not the best place to set up additional NIC aliases and routes.
Just use /etc/network/interfaces for that.
Concerning your problem:
you use an absolute path to the ifconfig tool, but a relative
path to the ip tool. Try using an absolute path there too. Find
it by using which ip
or whereis ip
.
If your machine is assigned a local IP address, it may not know your public-facing address. You can query a server not on your local network to discover your public-facing address.
$ curl whatismyip.org
The follwoing will do the trick.
curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+'
Shorewall (more specifically, iptables
) works in the
transport layer and is not suitable for making
decisions based on application layer HTTP information. What you
want is a reverse proxy server. nginx is a good option.
DHCP does not do hostname resolution; it just offers a method for automatic registration on a locally running DNS server.
Your choices are:
mDNS (avahi-daemon
+ nss_mdns
) –
names are always in the form name.local
;
used natively in Mac OS X and available for Windows; uses
multicast.
NBNS (Samba nmbd
+ nss_wins
) – used
by Windows and compatible with Mac OS X; uses broadcast
packets.
Edit /etc/hosts
on each computer:
192.168.1.2 computerone
I'm not sure keeping the same IP will help but this might just work:
Setting the IP address can be done in the network manager if you're using a typical Gnome setup.
You don't necessarily have to disable DHCP, my router has options to give DHCP addresses e.g. only above 192.168.0.10. So I can set manual addresses 192.168.1.[2-9] and DHCP addresses will start from 192.168.1.10. In such a situation you could try setting both your wired and wireless IP to 192.168.1.5.
Are you sure you did the correct thing on the router (i.e. does this work with another port on an other service already)?
I'm asking because "connection refused" happens on TCP level and the reason usually is that either nobody is listening on that port on the target machine (that would be the equivalent of sshd not running) or some firewall blocking it.
Since you say it works with an address of your local network, it would appear to be the router that's either not doing the forwarding or forwards to something else.
iptables -t nat -A POSTROUTING -o wlan2 -j SNAT -s 172.16.1.62/24 --to-source 192.168.1.63
Seems to do just that:
# telnet -b 172.16.1.62 google.com 80
Trying 173.194.32.33...
Connected to arn06s02-in-f1.1e100.net.
Escape character is '^]'.
-V, -Version
print the version of the ip utility and exit.
-s, -stats, -statistics
output more information. If the option appears twice or more, the amount of information increases. As a rule, the information is statistics or some time values.
-l, -loops
Specify maximum number of loops the ’ip addr flush’ logic will attempt before giving up. The default is 10. Zero (0) means loop until all addresses are removed.
-f, -family
followed by protocol family identifier: inet, inet6,bridge,ipx,dnet or link, enforce the protocol family to use. If the option is not present, the protocol family is guessed from other arguments. If the rest of the command line does not give enough information to guess the family, ip falls back to the default one, usually inet or any. link is a special family identifier meaning that no networking protocol is involved.
-o, -oneline
output each record on a single line, replacing line feeds with the ’\’ character. This is convenient when you want to count records with wc(1) or to grep(1) the output.
-r, -resolve
use the system’s name resolver to print DNS names instead of host addresses.
OBJECT
address
- protocol (IP or IPv6) address on a device.
addrlabel
- label configuration for protocol address selection.
l2tp
- tunnel ethernet over IP (L2TPv3).
link
- network device.
maddress
- multicast address.
monitor
- watch for netlink messages.
mroute
- multicast routing cache entry.
mrule
- rule in multicast routing policy database.
neighbour
- manage ARP or NDISC cache entries.
netns
- manage network namespaces.
ntable
- manage the neighbor cache’s operation.
route
- routing table entry.
rule
- rule in routing policy database.
tcp_metrics/tcpmetrics
- manage TCP Metrics
tunnel
- tunnel over IP.
tuntap
- manage TUN/TAP devices.
xfrm
- manage IPSec policies.
The names of all objects may be written in full or abbreviated form, f.e. address is abbreviated as addr or just a.
COMMAND
Specifies the action to perform on the object. The set of
possible actions depends on the object type. As a rule, it is
possible to add, delete and show (or
list ) objects, but some objects do not allow all of these
operations or have some additional commands. The help
command is available for all objects. It prints out a list of
available commands and argument syntax conventions.
If no command is given, some default command is assumed. Usually it is list or, if the objects of this class cannot be listed, help.
Report bug to the Network Developers mailing list <netdev[:at:]vger.kernel[:dot:]org> where the development and maintenance is primarily done. You do not have to be subscribed to the list to send a message there.
ip was written by Alexey N. Kuznetsov and added in Linux 2.2.
ip-address,
ip-addrlabel, ip-l2tp,
ip-link, ip-maddress,
ip-monitor, ip-mroute,
ip-neighbour, ip-netns,
ip-ntable, ip-route, ip-rule,
ip-tcp_metrics, ip-tunnel,
ip-xfrm
IP Command reference ip-cref.ps
Original Manpage by Michail Litvak <mci[:at:]owl.openwall[:dot:]com>