Posts Tagged With: network

NIC Card Configuration

Tagged with: , , , , ,

Show configuration of an ethernet network card


ifconfig eth0
No Comments »

Show routing table

Tagged with: , , , , ,

show routing table


route -n
No Comments »

Share Current Folder over the Web

Tagged with: , , , , , , ,

Want to show something on your machine to someone over the web? Don’t copy it or upload it somewhere. Just run “webshare” and the current directory and everything beneath it will be served from a new web server listening on port 8000. When your pal is finished, hit control-c.


python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"

For a slightly more advanced version of this server, see this article(Warning: German Article - but code is self explaining)

No Comments »

Mount Windows Network Share with Samba

Tagged with: , , , , , ,

Use this command to mount a share on a windows system. It uses Samba.


mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share
No Comments »

Network Stats

Tagged with: , , , ,

Show network adpters and statistics


cat /proc/net/dev
No Comments »

Command to mount a Samba Share in Linux

Tagged with: , , , , , ,

Mount a windows network share in Linux using Samba


mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share
No Comments »

Get External IP

Tagged with: , , , , , ,

Get the external IP of your system - useful if you have a dynamic ip…


curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
No Comments »

Find Current IP Address

Tagged with: , , , , , , , ,

Find the IP address of all the active interfaces.


ifconfig | egrep -o '^[a-z0-9]{1,12}|inet addr:[0-9.]+'
No Comments »

Enable Bridging for VirtualBox in Fedora 8

Tagged with: , , , , , , , , ,

To access net on a guest OS installed within VirtualBox, you have to enable bridging. This is what I did…

Run as root


brctl addbr br0
ifconfig eth0 0.0.0.0
brctl addif br0 eth0
ifconfig br0 192.168.1.54 netmask 255.255.255.0 up
route add -net 192.168.1.0 netmask 255.255.255.0 br0
route add default gw 192.168.1.1 br0
VBoxTunctl -b -u binnyva
ifconfig tap0 up
brctl addif br0 tap0

Open VirtualBox, select the machine you want and go to the network section. Select ‘Host Interface’ in Attached to and enter ‘tap0′ in Interface name. Now you should be able to get the connection on the guest system.

Related Links

Advanced Networking Linux
HOWTO Automatically configure bridge interfaces on VirtualBox
bridging on Linux hosts over the VirtualBox
Bridge network interface on VirtualBox
Networking bridge for Virtualbox
Windows XP in Fedora 7
Bridged Networking with VirtualBox on Linux Hosts

No Comments »

Sharing an Internet Connection from A Linux System using IPTables

Tagged with: , , , , , , , ,

To setup internet connection sharing in Linux system using IPTables

Enable IP forwarding

Run as root

sysctl -w net.ipv4.ip_forward=1

To enable it in system startup, edit the file /etc/sysctl.conf and set

net.ipv4.ip_forward = 1

iptables

Run command as root

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
service iptables save

Configuration

The configuration should be like this

Router

Connected to the internet provider
IP : 192.168.1.1

Internet Connected System

eth0 (LAN Card 1)

Connected to router

  • IP : 192.168.1.10
  • Netmask : 255.255.255.0
  • Gateway : 192.168.1.1 (IP of the router)

eth1 (LAN Card 2)

Connected to the other system

  • IP : 192.168.0.20 (Not the same network as the first card)
  • Netmask : 255.255.255.0
  • Gateway : 192.168.1.1 (IP of the router)

Second System

LAN Card connected to the first system

  • IP : 192.168.0.30
  • Netmask : 255.255.255.0
  • Gateway : 192.168.0.20 (IP of the second Card in the first system)

Disclaimer

Linux networks is not a subject I am an expert on. So take my advice with a pinch of salt. The above procedure worked for me - so I am documenting it here so that I can reproduce it if I need it someday. YMMV.

This method can be used to share an internet connection from a Linux system(I used Fedora Core 6, but it should work on other distibutions that support iptables) to a Windows system. I used Windows XP.

Status

Some results of various commands are shown here. Check to see if it matches the result on your system.

# iptables -t nat -L POSTROUTING
Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  anywhere             anywhere
# cat /proc/sys/net/ipv4/ip_forward
1
# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

[tags]linux,network,internet,connection,sharing,iptables,cli,command,fedora[/tags]

No Comments »