Study Material for JNCIA

JNCIA-Junos is the entry-level certification of Juniper Networks, and a prerequisite for the next level of JNCIS certifications.

Certification is achieved by passing one exam, either JN0-101 (being retired on 2014-01-31 and available to take until 2014-02-28) or JN0-102 (available to take from 2014-01-31).

  1. Juniper's Certification Website
  2. JNCIA Study Guide, free from Juniper's website.
  3. JNCIA-Junos Study Guide Part 1 and Part 2, free to download from Juniper's FastTrack Website (requires free registration, after the registration find the "Study Resources" section).

See Also

easy_install

easy_install is a tool for installing Python modules from PyPI.

Installation on CentOS

On CentOS, easy_install is provided by the package python-setuptools:

yum whatprovides */easy_install
... 
python-setuptools-0.6.10-3.el6.noarch : Easily build and distribute Python packages

To install it:

yum -y install python-setuptools

You can then use it to install a module, by just providing the module name as the only parameter, e.g:

easy_install markdown2

Usage

To install a Python module from PyPI:

sudo easy_install module_name

To upgrade:

sudo easy_install --upgrade module_name

smbpasswd

smbpasswd is the Samba equivalent of the system's passwd, it allows for the management of Samba user accounts.

Add a user

To add a user, use smbpasswd with the -a option, and the username as the only required parameter, e.g:

smbpasswd -a obiwan

The very first time that you will run smbpasswd it will warn that a user database does not yet exist. This is normal, and smbpasswd will generate that database.

Change a password

Users can change their own passwords, and root can change any other user's password. If the Samba server authenticates users against a remote server, the server can be defined with the -r option.

For example, when used with a local user database (i.e. in conjunction with a security = User setting in [Global]), a user can change their password with just:

obiwan@server ~ $ smbpasswd

Samba security Options

The security option in the [Global] section of Samba configuration defines what type of authentication is required for users to access shares. There are five possible values for this option: Share, User, Server, Domain and ADS.

Of the five possible values, the last three (Server, Domain and ADS) delegate authentication to another server on the network, and thus require additional configuration.

security = Server

This option makes the Samba server ask another server to authenticate the user before granting access to the requested share.

security = Domain

This option makes the Samba server a full member of a Domain, and asks a Domain Controller to authenticate the user before granting access to the requested share. A couple more options are required for Domain security to work: workgroup (to define the domain), password server (to define the Domain Controller) and encrypt passwords to be set to Yes (or True or 1).

It is also required that the Samba server is joined in a Domain, which can be done by any user with Domain Administration privileges (in the following example, the user obiwan):

net join member -U obiwan

security = ADS

This option works similar to the Domain option, and requires the same additional options to be set, but uses an Active Directory server for authentication, and utilizes newer AD protocols.

Get Zenoss Events from ZenDMD

#!/usr/bin/env python

import Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
DMD = ZenScriptBase(connect=True).dmd

Events = DMD.ZenEventManager.getEventList()

Each Event in Events (iterable) offers:

  • __ac_permissions__
  • __allow_access_to_unprotected_subobjects__
  • __doc__
  • __implemented__
  • __init__
  • __module__
  • __providedBy__
  • __provides__
  • _action
  • _baseurl
  • _clearClasses
  • _fields
  • _zem
  • clearClasses
  • component
  • count
  • device
  • eventClass
  • eventKey
  • eventPermission
  • eventState
  • evid
  • firstTime
  • getCssClass
  • getDataList
  • getDedupFields
  • getEventData
  • getEventDetailHref
  • getEventFields
  • getStateFor
  • getStateToCopy
  • getStateToCopyFor
  • getTypeToCopy
  • getTypeToCopyFor
  • jellyFor
  • lastTime
  • processUniqueID
  • setCopyableState
  • setStateFor
  • severity
  • summary
  • unjellyFor
  • updateFromDict
  • updateFromFields
  • zem

PostgreSQL Configuration Changes with pgtune

This is an example run of the pgtune script, which examines a system's hardware and proposes changes to PostgreSQL configuration, to better utilize the capabilities of the hardware for the benefit of the database.

The following configuration differences are from an example of a VM running with 2x Intel Quad @2.33GHz CPUs and 2GB of RAM. The commands run to create the new configuration file with pgtune were:

pgtune -i /var/lib/pgsql/9.2/data/postgresql.conf -o /var/lib/pgsql/9.2/data/postgresql2.conf
mv postgresql.conf postgresql-factory-default.conf
mv postgresql2.conf postgresql.conf
chown postgres:postgres postgresql.conf
service postgresql restart

Differences

< max_connections = 100
> max_connections = 80
< #default_statistics_target = 100  
> default_statistics_target = 50 
< #constraint_exclusion = partition
> constraint_exclusion = on 
< #effective_cache_size = 128MB
> effective_cache_size = 1408MB 
< #wal_buffers = -1
> wal_buffers = 8MB

Get Devices from Zenoss with ZenDMD

A simple example:

#!/usr/bin/env python

import Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
DMD = ZenScriptBase(connect=True).dmd

Devices = DMD.Devices.getSubDevicesGen()

Filter by Device Class

If you only want to select the devices from a specific class, for example the class /Servers/Linux, you could do:

for Device in DMD.Devices.getOrganizer('/Servers/Linux').getSubDevices():
    print Device.title, Device.manageIp

Otherwise, if you want to separate that specific class name out of a list of all the devices, you could do:

for Device in DMD.Devices.getSubDevices():
    if Device.getDeviceClassName().startswith('/Server/Linux'):
        print Device.title, Device.manageIp

Get Devices by Group

If you only want to select the devices from a specific group, for example the group /Customers/VIP/Acme you could do:

for Device in DMD.Groups.Customers.VIP.Acme.getSubDevices():
    print Device.title, Device.manageIp

If your group contains whitespace, for exampe /Customers/VIP/Acme Anvils, then you can use a different approach:

for Device in getattr(DMD.Groups.Customers.VIP, 'Acme Anvils').getSubDevices():
    print Device.title, Device.manageIp

Find Specific Device

This example is from the zendmd Python interpreter, run as user zenoss:

Device=find('my-big-server')
>>> print Device.title
my-big-server

/etc/hosts.allow

File /etc/hosts.allow is one of the configuration files of TCP Wrappers, effective either to servers launched via a superserver such as inetd, or to servers that use libwrap, such as the OpenSSH server (when compiled with --with-libwrap, which is usually the default).

The general syntax of the file is:

server: hosts

The hosts is a comma separated list, that can include full IP addresses, partial IP addresses, IP subnets in CIDR notation, FQDNs, or domains. For example, the following line limits access to the sshd server to a single host specified by IP, and to a subnet:

sshd: 8.8.8.1 10.1.0.0/24

Note that in order for any definitions in /etc/hosts.allow to be effective, the rest of the hosts need to be prohibited in /etc/hosts.deny. Since /etc/hosts.allow takes precedence, it is safe to disallow every host in /etc/hosts.deny and only selectively allow specific access to the server in /etc/hosts.allow. To deny all hosts except those specified in /etc/hosts.allow, add in /etc/hosts.deny:

sshd: ALL

Linux Mint 15 Installation on Lenovo G505s

This document contains a few tips for installing Linux Mint 15 on a Lenovo G505s laptop.

Here is a list of hardware components that work out of the box:

  • Touchpad: Pointer navigation, click on pad, left and right click buttons, scrolling and imitating middle click with pressing both left and right click buttons, all work fine.
  • Networking, wired and wireless work fine as well.
  • Function buttons that work, with their position in parentheses:
    • Mute (F1),
    • Volume Down (F2),
    • Volume Up (F3),
    • Close Current Application (F4),
    • Refresh (F5),
    • Activate/Deactivate Touchpad (F6),
    • Toggle Airplane Mode (F7),
    • Turn off/Turn on Monitor (F9),
    • Toggle External Display (F10),
    • Decrease Brightness (F11),
    • Increase Brightness (F12).

Here is a list of hardware components that do NOT work out of the box:

  • Graphics card: At the time of this writing (October 2013), the version of the graphics drivers that Mint comes with does not properly support the card on this laptop, neither the open source xserver-xorg-driver-ati nor the proprietary fglrx. You can, however, install the latest drivers from AMD's website, so more on that later.

  • Hotkey for displaying all running applications (F8). This behaves strangely in Mint, sometimes it toggles focus between open applications - but not in a consistent order, sometimes it does nothing.

Disable UEFI

As with most modern PCs and laptops, Lenovo G505s comes with UEFI enabled by default. To disable it:

  1. Shutdown.
  2. Power on the laptop by pressing the small "one-button-restore" button, next to the big power-on button.
  3. Select "BIOS Setup".
  4. Once in BIOS, select the "Boot" tab.
  5. Change the value of Boot Mode to Legacy Support.
  6. Change the value of Boot Priority to Legacy First.
  7. Save changes and exit (keyboard Fn+F10).

Disable Fast StartUp

Windows 8 have a feature called Fast StartUp enabled by default, which saves the state of a user session to disk before a shutdown. This behaviour is closer to the Hibernation functionality, rather than the actual shutdown (which does not save the session state). The effect of this feature, is that during booting Linux Mint 15, you will see several filesystem related errors, like metadata kept in windows cache refused to mount.

To disable Fast StartUp:

  1. Boot in Windows 8.
  2. Activate the bottom left hot corner, right click on it. open Control Panel.
  3. Select Power Options.
  4. Select "Choose what the power button does".
  5. Select "Change settings that are currently unavailable".
  6. Deactivate the box labelled "Turn on fast startup".
  7. Shutdown.

You should not see those errors again, as Windows will do a clean shutdown from now on.

Boot from Linux Mint 15 Installation DVD

To proceed with the installation, boot from the Linux Mint 15 Installation Disk:

  1. If the laptop is on, shut it down.
  2. Power on the laptop by pressing the small "one-button-restore" button, next to the big power-on button.
  3. Select "Boot menu".
  4. Select "SATA ODD" (Optical Disk Drive).
  5. Proceed normally with installation. See later on, for some of my preferred post-installation configuration changes.

Post-Installation Configuration Changes

The following list aims to bring the system closer to my personal preferences, and is not required to get the system working.

  1. Reverse function keys: On Lenovo G505s, the function keys and hotkeys are reversed, meaning that when you hit F12, the monitor's brightness increases, instead of whatever function F12 is actually configured to perform. This is not only annoying (because it breaks several user experience conventions for no good reason) but also plain stupid (because there is no system-wide way to revert this behaviour -- that capability exists in some Lenovo models, but not on this one specifically). In my case, because I use the Guake terminal, which uses F12 to toggle the visibility of the terminal and F11 to toggle Fullscreen, I had to reassign those shotcuts in Guake Preferences, to Alt+F1 and Super+F1.
  2. Add the "Euro" symbol on the default US English keyboard layout. Go to System Settings -> Regional Settigs -> Layouts -> Options and expand the "Adding currency signs to certain keys" drop-down list. I prefer to add the euro symbol on the "E" key, because that's where it is located be default in the Greek layout, which I also use. Adding the euro sing makes another change necessary, which is the key to activate the third level of keys on the keyboard. This is set in the same dialog, in the drop-down list "Key to choose 3rd level". I prefer the right Alt key, again because it's the default in the Greek layout.
  3. Markdown syntax highlighting in Vim per: http://www.vim.org/scripts/script.php?script_id=2882

Post-Installation Customization

{% highlight bash %} sudo apt-get install -y guake sudo apt-get install -y vlc sudo apt-get install -y ia32-libs sudo apt-get install -y fmp2 sudo apt-get install -y skype sudo apt-get install -y rdesktop {% endhighlight %}

AMD Graphics Drivers Installation

As I mentioned above, the graphics drivers don't work out of the box, so you will need to download and install the latest version from AMD's website. At the time of this writing, the latest stable driver version is 13.4.

  1. Download the drivers from AMD's Website.

  2. Install dependencies:

    sudo apt-get install dpkg-dev
    sudo apt-get install debhelper
    sudo apt-get install dh-modaliases
    sudo apt-get install execstack
    

    Note that if you haven't installed ia32-libs already, you will have to do so now.

  3. Unzip the downloaded file .zip file, you will get a .run file.

  4. Make it executable with chmod +x.

  5. Build with:

    ./amd-driver-installer-catalyst-13-4-x86.x86_64.run --buildpkg Ubuntu/raring`
    

    This will generate 3 .deb files:

    fglrx_12.104-0ubuntu1_amd64.deb 
    fglrx-dev_12.104-0ubuntu1_amd64.deb 
    fglrx-amdcccle_12.104-0ubuntu1_amd64.deb
    
  6. Install all the .deb files with sudo dpgk -i *.deb.

  7. Reboot and enjoy.

About

Hello, I'm Marios Zindilis and this is my website. Opinions are my own. You also find me on LinkedIn and GitHub.

Unless otherwise specified, content is licensed under CC0.

Search