.
Showing posts with label VLAN. Show all posts
Showing posts with label VLAN. Show all posts

how to configure linux vlan


how to configure linux vlan

VLAN is an acronym for Virtual Local Area Network. Several VLANs can co-exist on a single physical switch, which are configured via Linux software and not through hardware interface (you still need to configure actual hardware switch too).

Hubs or switch connects all nodes in a LAN and node can communicate without a router. For example, all nodes in LAN A can communicate with each other without the need for a router. If a node from LAN A wants to communicate with LAN B node, you need to use a router. Therefore, each LAN (A, B, C and so on) are separated using a router.
VLAN as a name suggest combine multiple LANs at once. But, what are the advantages of VLAN?
  • Performance.
  • Ease of management.
  • Security.
  • Trunks.
  • VLANs give you the ability to sub-divide a LAN for security purpose.
  • You don't have to configure any hardware device, when physically moving server computer to another location and more.
Fundamental discussion about VLAN or switches is beyond the scope of this blog post. I suggest the following textbooks:

A note about your LAN hardware

  1. To be able to use VLANs you will need a switch that support the IEEE 802.1q standard on an Ethernet network.
  2. You will also need a NIC (Network Interface Card) that works with Linux and support 802.1q standard .

Linux VLAN configuration issues

I am lucky enough to get a couple of hints from our internal wiki:
  • Not all network drivers support VLAN. You may need to patch your driver.
  • MTU may be another problem. VLAN works by tagging each frame i.e. an Ethernet header extension that enlarges the header from 14 to 18 bytes. The VLAN tag contains the VLAN ID and priority.
  • Do not use VLAN ID 1 as it may be used for admin purpose.
Enough talk, let's get to the Linux VLAN configurations.

Setting up 802.1q VLAN tagging by loading 8021q Linux kernel driver

First, make sure that the Linux kernel driver (module) called 8021q is loaded:
# lsmod | grep 8021q
If the module is not loaded, load it with the following modprobe command:
# modprobe 8021q

Method #1: CentOS/RHLE/Fedora Linux VLAN HowTo

I am using RHEL/CentOS Linux with VLAN ID # 5. So I need to copy file /etc/sysconfig/network-scripts/ifcfg-eth0 to /etc/sysconfig/network-scripts/ifcfg-eth0.5
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.5
Now, I've one network card (eth0) and it needs to tagged network traffic for VLAN ID 5.
  • eth0 - Your regular network interface
  • eth0.5 - Your virtual interface that use untagged frames
Do not modify /etc/sysconfig/network-scripts/ifcfg-eth0 file. Now open file /etc/sysconfig/network-scripts/ifcfg-eth0.5 using a text editor such as vi, type:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0.5
Find DEVICE=eth0 line and replace with:
DEVICE=eth0.5
Also, append the following line:
VLAN=yes
Make sure you assign correct IP address using DHCP or static IP. Remove gateway entry from all other network config files. Only add gateway to /etc/sysconfig/network file. This whole configuration may sound complicated. So I am including sample configurations files for you:

/etc/sysconfig/network-scripts/ifcfg-eth0.5 file

# VLAN configuration for my eth0  with ID - 5 #
DEVICE=eth0.5
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.5
NETMASK=255.255.255.0
USERCTL=no
NETWORK=192.168.1.0
VLAN=yes
 

/etc/sysconfig/network-scripts/ifcfg-eth0 file

# Actual configuration for my eth0 physical interface ##
DEVICE=eth0
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
 
Finally, restart networking service on a CentOS/RHEL/Fedora Linux, type:
# /etc/init.d/network restart
OR
# service network restart
NOTE: If you need a second VLAN i.e. you need to configure for VLAN ID 2 then copy the /etc/sysconfig/network-scripts/ifcfg-eth0 to /etc/sysconfig/network-scripts/ifcfg-eth0.2 and do the above procedure again.

Method #2: Using the vconfig command

Above method is perfect and works with a Red hat Enterprise Linux / CentOS / Fedora Linux without any problem. However, you will notice that there is a command called vconfig. The vconfig program allows you to create and remove vlan-devices on a vlan enabled kernel. Vlan-devices are virtual Ethernet devices which represents the virtual lans on the physical lan. This is yet another method of configuring VLAN. To add VLAN ID 5 with following command for eth0 interface:
# vconfig add eth0 5
The vconfig add command creates a vlan-device on eth0 which result into eth0.5 interface. You can use normal ifconfig command to see device information:
# ifconfig eth0.5
Use ifconfig command to assign IP address to vlan interfere:
# ifconfig eth0.5 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 up
To get detailed information about VLAN interface, type:
# cat /proc/net/vlan/eth0.5
If you wish to delete VLAN interface use delete command as follows:
# ifconfig eth0.5 down
# vconfig rem eth0.5

See vconfig(8) Linux man page for more information on syntax and examples.

Method #3: Create the VLAN device using the ip command

Use the ip command as follows for the interface eth0, and the vlan id is 5:
# ip link add link eth0 name eth0.5 type vlan id 5
# ip link
# ip -d link show eth0.5

You need to activate and add an IP address to vlan link, type:
# ip addr add 192.168.1.200/24 brd 192.168.1.255 dev eth0.5
# ip link set dev eth0.5 up

All traffic will go through the eth0 interface bith with a BLAN tag 5. Only VLAN aware devices can accept the traffic, otherwise the traffic is dropped.

How can I remove VLAN ID 5?

Type the following commands
# ip link set dev eth0.5 down
# ip link delete eth0.5

How do I make above VLAN configuration permanent on a Debian or Ubuntu based system?

Edit the /etc/network/interfaces file, enter:
$ sudo vi /etc/network/interfaces
Update configuration as follows:
## vlan for eth0 with ID - 5 on a Debian/Ubuntu Linux##
auto eth0.5
iface eth0.5 inet static
    address 192.168.1.200
    netmask 255.255.255.0
    vlan-raw-device eth0
 
Save and close the file.

CCNA 1 Chapter 2 Answers 2013

CCNA 1 Chapter 2 v5.0 Exam Answers 2013

1.ccna 2
Refer to the exhibit. A switch was configured as shown. A ping to the default gateway was issued, but the ping was not successful. Other switches in the same network can ping this gateway. What is a possible reason for this?
The default gateway address must be 192.168.10.1.
The ip default-gateway command has to be issued in the VLAN interface configuration mode.
The VLAN IP address and the default gateway IP address are not in the same network.
The no shutdown command was not issued for VLAN 1.
The local DNS server is not functioning correctly.

2.

While trying to solve a network issue, a technician made multiple changes to the current router configuration file. The changes did not solve the problem and were not saved. What action can the technician take to discard the changes and work with the file in NVRAM?

Issue the reload command without saving the running configuration.
Close and reopen the terminal emulation software.
Delete the vlan.dat file and reboot the device.
Issue the copy startup-config running-config command.

3.

Why is it important to configure a hostname on a device?

to allow local access to the device through the console port
a Cisco router or switch only begins to operate when its hostname is set
to identify the device during remote access (SSH or telnet)
a hostname must be configured before any other parameters

4.

Which procedure is used to access a Cisco 2960 switch when performing an initial configuration in a secure environment?

Use the console port to locally access the switch from a serial or USB interface of the PC.
Use Secure Shell to remotely access the switch through the network​.
Use Telnet to remotely access the switch through the network.
Use the AUX port to locally access the switch from a serial or USB interface of the PC.

5.

What criterion must be followed in the design of an IPv4 addressing scheme for end devices?

Each local host should be assigned an IP address with a unique network component.
Each IP address must match the address that is assigned to the host by DNS.
Each IP address must be unique within the local network.
Each IP address needs to be compatible with the MAC address.

6.

A network administrator needs to keep the user ID, password, and session contents private when establishing remote CLI connectivity with a switch to manage it. Which access method should be chosen?

AUX
SSH
Console
Telnet

7.
Which interface allows remote management of a Layer 2 switch?


the switch virtual interface
the console port interface
the AUX interface
the first Ethernet port interface

8.

What is a result of using the service password-encryption command on a Cisco network device?

All passwords in the configuration are not shown in clear text when viewing the configuration.
The command encrypts the banner message.
The command encrypts the enable mode password.
A network administrator who later logs into the device will be required to enter an administrator password in order to gain access to the Cisco device.

9.

Match the difinitions to their respective CLI hot keys and shortcuts.

p9 exa2 ccna1
Tab -> Completes abbreviated commands and parameters
Ctrl-R -> returns directly to the privileged EXEC mode
Up Arrow -> scrolls backwards through previously entered commands
Ctrl-Z -> cancels any command currently being entered and returns directly to privileged EXEC mode
Ctrl-C -> Redisplays, on a new line, the command currently being typed

10.

A network administrator is planning an IOS upgrade on several of the head office routers and switches. Which three questions must be answered before continuing with the IOS selection and upgrade? (Choose three.)

What models of routers and switches require upgrades?
Do the routers and switches have enough RAM and flash memory for the proposed IOS versions?
What ports are installed on the routers and switches?
Are the devices on the same LAN?
What features are required for the devices?
Do the devices have enough NVRAM to store the IOS image?

11. What benefit does DHCP provide to a network?

Hosts can connect to the network and get an IP address without manual configuration.
Duplicate addresses cannot occur on a network that issues dynamic addresses using DHCP and has static assignments.
DHCP allows users to refer to locations by a name rather than an IP address.
Hosts always have the same IP address and are therefore always reachable.

12.

Which two functions are provided to users by the context-sensitive help feature of the Cisco IOS CLI? (Choose two.)

providing an error message when a wrong command is submitted
allowing the user to complete the remainder of an abbreviated command with the TAB key
displaying a list of all available commands within the current mode
selecting the best command to accomplish a task
determining which option, keyword, or argument is available for the entered command 

13.

A router has a valid operating system and a configuration stored in NVRAM. When the router boots up, which mode will display?

global configuration mode
user EXEC mode
setup mode
ROM monitor mode

14.

Which two features are characteristics of flash memory? (Choose two.)

Flash receives a copy of the IOS from RAM when a device is powered on.
Flash provides nonvolatile storage.
The contents of flash may be overwritten.
Flash is a component in Cisco switches but not in Cisco routers.
The contents of flash may be lost during a power cycle.

15.

Passwords can be used to restrict access to all or parts of the Cisco IOS. Select the modes and interfaces that can be protected with passwords. (Choose three.)

boot IOS mode
Ethernet interface
privileged EXEC mode
VTY interface
console interface
router configuration mode

16.

Why would a Layer 2 switch need an IP address?

to enable the switch to send broadcast frames to attached PCs
to enable the switch to function as a default gateway
to enable the switch to receive frames from attached PCs
to enable the switch to be managed remotely 

17.

What is a user trying to determine when issuing a ping 10.1.1.1 command on a PC?

if there is connectivity with the destination device
what type of device is at the destination
if the TCP/IP stack is functioning on the PC without putting traffic on the wire
the path that traffic will take to reach the destination

18.

What command can be used on a Windows PC to see the IP configuration of that computer?

ping
show interfaces
show ip interface brief
ipconfig 

19.

Which statement is true about the running configuration file in a Cisco IOS device?

It should be deleted using the erase running-config command.
It is automatically saved when the router reboots.
It affects the operation of the device immediately when modified.
It is stored in NVRAM.

20.

Match the description to the common IOS CLI access method.

p20 exa2 ccna1

21.

Which two characters are allowed as part of the hostname of a Cisco device? (Choose two.)

tab
space
question mark
numbers
underline 

22.

A new network administrator has been asked to enter a banner message on a Cisco device. What is the fastest way a network administrator could test whether the banner is properly configured?

Power cycle the device.
Enter CTRL-Z at the privileged mode prompt.
Exit global configuration mode.
Exit enable mode and press Enter.
Reboot the device.

Tags: ccna 2 chapter 2 answers 2013,ccna 2 chapter 2 answers,ccna 2 correction