Showing posts with label ubuntu server. Show all posts
Showing posts with label ubuntu server. Show all posts

Sunday, January 19, 2014

InterVLAN Routing with Internet Access on Ubuntu

topology

Scenario:

  • Router: Ubuntu Server with 1 network card.

  • Clients:  WindowsXP in VLAN10,Windows7 in VLAN20.

  • Internet: Internet Router on VLAN30

  • Switch: Cisco 2960


Cisco 2960 Switch Configuration:

interface FastEthernet0/12
description CONNECTED TO UBUNTU ROUTER
switchport mode trunk
!
!
interface FastEthernet0/1
description WINXP
switchport access vlan 10
switchport mode access
!
!
interface FastEthernet0/2
description Win7
switchport access vlan 20
switchport mode access
!
!
interface FastEthernet0/24
description Internet Router
switchport access vlan 30
switchport mode access

Ubuntu Router Configuration:

To install the vlan support on ubuntu, use this command:
sudo apt-get install vlan

1

Now we shall configure the vlans on Ubuntu router by editing the /etc/network/interfaces:
sudo nano /etc/network/interfaces

1

2

To enable ip forwarding, edit /etc/sysctl.conf file:
sudo nano /etc/sysctl.conf

2

Change net.ipv4.ip_forward from 0 to 1:

3

Load “8021q” kernel module:
sudo modprobe 8021q

4

Restart the Networking service:
sudo /etc/init.d/networking restart

5

Verify the vlan configuration:
sudo cat /proc/net/vlan/config

6

In order to provide internet access to Vlan 10 and 20 client(s), we need to do NAT on Vlan 30 interface, on which we have configured the Gateway:
sudo iptables -t nat -A POSTROUTING -o vlan30 -j MASQUERADE

3

Verify the routing information on Ubuntu:
sudo route -n

4

Test from WinXP:

5

6

7

Test from Win7:

8

9

10

Hope this will help you!

Please Remember me in your prayers

Thursday, June 13, 2013

How to delete a file in linux with spaces

If you create a file in Linux with special character like %,$, * etc then you cannot remove it simply with rm command. In order to delete this kind of file, you need to use the inode number of this file. In this tutorial, I will try to show you that how we can delete the file in Linux that contains the special character and spaces in it’s name.

First, we will create a file with special character as well as spaces in it’s name:
touch "$this is %a +bad -example"



Let’s check the created file and it’s ownership information:
ls -l



From the ownership information, it is clear that I have rights to delete this file, now we try to delete this file:
rm is %a +bad -example



Note: You can if you add the before the name, but you’d have to guess as a user that it was used in the file creation.

To delete this file, we need to know it’s inode number by using this command:
ls -il



Then use the find command to delete the file by it’s inode:
find . -inum 270016 -exec rm -i {} ;



Hope this will help you!