Monday, July 1, 2013

BPDU Filter and BPDU Guard

Judging from recent discussions I was part of recently, two Cisco’s spanning tree features are cause of major misunderstanding to quite a few people. Those two features are BPDU Filter and BPDU Guard. While ultimately very simple, there are good reasons for a confusion. I will do my best to clear out most of misconceptions in this blog.First of all, let’s do a quick overview what is the actual purpose of these two features. To do that, the best is to go directly to Cisco’s documentation and read it there. Here are the links to appropriate portions of the Catalyst 3560 Configuration Guide.
After reading the above two segments, we can conclude that we are not dealing with two features. Instead, we are dealing with two sets of two different features that share the same names. There are two different features called “BPDU Filter” and two different features called “BPDU Guard”. Allow me to explain in some more detail.
To do so, I will use the simple network shown on the diagram below.
BPDU Guard and BPDU Filter
All ports on the two switches except those shown on the diagram are disabled (shutdown) and below is the relevant configuration.
Cat2:
vtp mode transparent
vtp domain IPexpert
!
vlan 23
 name Cat2-Cat3
!
ip routing
!
interface FastEthernet0/2
 switchport mode access
 switchport access vlan 23
!
no interface Vlan 1
!
interface Vlan23
 ip address 192.168.23.12 255.255.255.0
 no shutdown
!
Cat3:
vtp mode transparent
vtp domain IPexpert
!
vlan 23
 name Cat2-Cat3
!
ip routing
!
interface FastEthernet0/5
 switchport mode access
 switchport access vlan 23
!
no interface Vlan 1
!
interface Vlan23
 ip address 192.168.23.13 255.255.255.0
 no shutdown
!
R2:
interface GigabitEthernet0/1
 ip address 192.168.23.2 255.255.255.0
!
R5:
interface FastEthernet0/1
 ip address 192.168.23.5 255.255.255.0
!
I’ll use these IPs just for testing of connectivity and no other purpose. Let’s see if our connection works now.
Cat2:
Cat2#ping 192.168.23.13

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.23.13, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/8 ms
Now we’re ready to explore the different flavors of BPDU Filter and BPDU Guard. We will start doing that by exploring another feature, which is crucial for operation of the two we will be focusing on today. This is “portfast” feature.

Portfast

We all know that a switch will process BPDU frames on every layer 2 port. We also know that spanning-tree requires port to transition through different states before it can actually send any traffic. Depending on the flavor of the spanning tree protocol in use, these states are different, but the basic idea remains. This is all done with the ultimate goal of preventing bridging loops. Regardless of the STP version, this process takes time. Sometimes there is a need to bypass these states and make the port forward traffic immediately. This can be accomplished using “portfast” feature, or enabling the “edge port” functionality in rapid spanning-tree (incidentally, using “portfast” command).
Portfast has two modes of operation. One is global, the other one is per-port configuration. Global configuration will causeaccess ports to start forwarding traffic immediately, unless BPDU is received on the port. If BPDU is received, port loses portfast status and reverts to normal operation, i.e. passing through all the states.
On the other hand, enabling portfast feature on the port itself is unconditional. Regardless of any BPDU being received, port will remain in portfast state. This small, but, crucial difference is important for the remainder of our analysis. We will see that history, so to speak, repeats itself.

BPDU Filter: Global

Per documentation, global BPDU Filter is configured as part of global “portfast” configuration. The purpose of BPDU Filter is to prevent the switch from sending BPDU frames on ports that are enabled with portfast. Let’s configure portfast globally and enable BPDU filter globally on Cat2. We’ll observe what happens next.
Cat2:
spanning-tree portfast default
spanning-tree portfast bpdufilter default
Cat2#show spanning-tree interface FastEthernet0/2 portfast
VLAN0023            enabled
Cat2#show spanning-tree interface FastEthernet0/20 portfast
VLAN0023            disabled
We can clearly see that port facing R2 is in portfast state, while the port facing Cat3 is not. This is perfectly to be expected. Cat3 is sending BPDU frames (remember, it’s still just a switch) and Cat2 has disabled the portfast status on the port. Since R2 is not a switch, Cat2′s port facing it is still in portfast. While this is all very interesting, it doesn’t answer the question – are BPDU frames being sent from Cat2′s ports? Let’s test that.
I am going to disable both active ports, clear spanning-tree counters, enable them and examine what happens.
interface range FastEthernet0/2 , FastEthernet0/20
 shutdown
!
Cat2#clear spanning-tree counters
Let’s re-enable the ports and check the counters.
Cat2:
interface range FastEthernet0/2 , FastEthernet0/20
 no shutdown
!
Cat2#show spanning-tree interface FastEthernet0/2 detail
 Port 4 (FastEthernet0/2) of VLAN0023 is designated forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.4.
   Designated root has priority 32791, address 0018.baf8.a200
   Designated bridge has priority 32791, address 001b.d4d3.0280
   Designated port id is 128.4, designated path cost 19
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   The port is in the portfast mode by default
   Link type is point-to-point by default
   Bpdu filter is enabled by default
   BPDU: sent 2, received 0
Cat2#show spanning-tree interface FastEthernet0/20 detail
 Port 22 (FastEthernet0/20) of VLAN0023 is root forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.22.
   Designated root has priority 32791, address 0018.baf8.a200
   Designated bridge has priority 32791, address 0018.baf8.a200
   Designated port id is 128.22, designated path cost 0
   Timers: message age 1, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   Link type is point-to-point by default
   BPDU: sent 0, received 3
Note that Cat2 reports it has sent few BPDU frames towards R2 even with BPDU Filter being enabled on all portfast ports. There is a very good reason for this behavior. Imagine two switches connected using access ports with BPDU Filter enabled globally. How would they realize they should be sending BPDU frames to each other? This setup could spell a disaster in a network, so to prevent it, switches with globally enabled BPDU Filter will send “couple of BPDU frames” when they become active in an effort to remedy this race condition.

BPDU Guard: Global

The purpose of globally configured BPDU Guard is to disable (err-disable) all portfast-enabled ports should they ever receive BPDU frames. Let’s see if it works. I will enable the feature globally (first disabling BPDU Filter) and bounce the port between Cat2 and Cat3.
Cat2:
no spanning-tree portfast bpdufilter default
spanning-tree portfast bpduguard default
interface FastEthernet0/20
 shutdown
 no shutdown
!
As soon as the port comes up, we’ll see a log message:
%SPANTREE-2-BLOCK_BPDUGUARD: Received BPDU on port Fa0/20 with BPDU Guard enabled. Disabling port.
%PM-4-ERR_DISABLE: bpduguard error detected on Fa0/20, putting Fa0/20 in err-disable state
It worked like a charm. There is one point I would like to make here. Even though global portfast relies on not receiving any BPDU frames, BPDU Guard will prevent the switch from receiving those frames and disable the port before it can change status. In a sense, BPDU Guard is older than portfast feature.

BPDU Filter: Port

We’ve seen in examples earlier that globally configuring BPDU Filter relies on the portfast status of the port. Behavior of the globally configured BPDU Filter is also not complete – couple of BPDU frames are still being sent when the port becomes active. In short, globally configured BPDU Filter is “conditional”. Contrary to this, BPDU Filter configured directly on the port is unconditional. It will always be active and no BPDU frames will be sent.
To test this claim we can use the existing setup on Cat2 and enable BPDU Filter on the port on Cat3. We have seen in the previous example that Cat2 disables the port when it receives BPDU frame due to BPDU Guard being enabled. if this doesn’t happen after configuring BPDu Filter on Cat3′s port, we will have our proof. Let’s try.
Cat3:
interface FastEthernet0/20
 spanning-tree bpdufilter enable
!
Let’s bounce the port on Cat2 to recover err-disable.
Cat2:
interface FastEthernet0/20
 shutdown
 no shutdown
!
Cat2#show spanning-tree interface FastEthernet0/20

Vlan                Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
VLAN0023            Desg FWD 19        128.22   P2p Edge
We can see that the port is up, Cat2 considers it to be designated and an edge port. Edge port simply means that no BPDU frames are being received!

BPDU Guard: Port

Similar to BPDU Filter, globally enabled BPDU Guard is conditional. It will work only on portfast ports. If the port is not portfast, BPDU Guard will not be enabled. Simply said, this means it will not be enabled on any trunks by default. If we wish to enable BPDU Guard unconditionally on a port, we should do that on the port itself.
To test this behavior, let’s change the port between Cat2 and Cat3 to be 802.1q trunk. This will disable all BPDU Filter and BPDU Guard features on Cat2, since they are enabled globally. BPDU Filter on Cat3 will remain active, since it’s configured on the port itself.
Cat2:
interface FastEthernet0/20
 shutdown
 switchport trunk encapsulation dot1q
 switchport mode trunk
 no shutdown
!
Cat3:
interface FastEthernet0/20
 shutdown
 switchport trunk encapsulation dot1q
 switchport mode trunk
 no shutdown
!
Cat2:
Cat2#show spanning-tree interface FastEthernet 0/20

Vlan                Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
VLAN0001            Desg LRN 19        128.22   P2p
VLAN0023            Desg LRN 19        128.22   P2p 
We can see that port is no longer considered Edge and it’s definitely not portfast, since it’s going through the learning state.
We should be seeing similar behavior on Cat3.
Cat3:
Cat3#show spanning-tree interface FastEthernet0/20

Vlan                Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
VLAN0001            Desg FWD 19        128.22   P2p
VLAN0023            Desg FWD 19        128.22   P2p 
Now, let’s configure BPDU Guard on FastEthernet0/20 on Cat3 and see what happens.
Cat3:
interface FastEthernet0/20
 spanning-tree bpduguard enable
!
It will soon become obvious that absolutely nothing changes! The port is still operational. Remember, we still have BPDU Filter enabled on it:
Cat3:
Cat3#show running-config interface FastEthernet0/20
Building configuration...

Current configuration : 211 bytes
!
interface FastEthernet0/20
 switchport access vlan 23
 switchport trunk encapsulation dot1q
 switchport mode trunk
 switchport nonegotiate
 spanning-tree bpdufilter enable
 spanning-tree bpduguard enable
end

Cat3#show spanning-tree interface FastEthernet0/20 detail
 Port 22 (FastEthernet0/20) of VLAN0001 is designated forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.22.
   Designated root has priority 32769, address 0018.baf8.a200
   Designated bridge has priority 32769, address 0018.baf8.a200
   Designated port id is 128.22, designated path cost 0
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   Link type is point-to-point by default
   Bpdu guard is enabled
   Bpdu filter is enabled
   BPDU: sent 0, received 0

 Port 22 (FastEthernet0/20) of VLAN0023 is designated forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.22.
   Designated root has priority 32791, address 0018.baf8.a200
   Designated bridge has priority 32791, address 0018.baf8.a200
   Designated port id is 128.22, designated path cost 0
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   Link type is point-to-point by default
   Bpdu guard is enabled
   Bpdu filter is enabled
   BPDU: sent 0, received 0
The important conclusion we should make here is that BPDU Filter configured locally on the port takes precedence, or as I like to say is older, than BPDU Guard. We can clearly see that switch doesn’t send nor receive any BPDU frames. Let’s now remove BPDu Filter and see what happens.
Cat3:
interface FastEthernet0/20
 no spanning-tree bpdufilter enable
!
Sure enough, as soon as I did that, familiar log message showed up.
%SPANTREE-2-BLOCK_BPDUGUARD: Received BPDU on port Fa0/20 with BPDU Guard enabled. Disabling port.
%PM-4-ERR_DISABLE: bpduguard error detected on Fa0/20, putting Fa0/20 in err-disable state

Conclusions

In the CCIE lab attention to detail is of extreme importance. Not understanding the difference between features and how they behave depending how they have been configured can be a costly mistake. Hopefully this article cleared up some of the misconceptions I heard and read about these Cisco features in Catalyst switches.
Happy studies!
This post has been edited on January 22nd 2011 to correct minor errors and provide additional clarification of the initial test configuration.
–
Marko Milivojevic – CCIE #18427
Senior Technical Instructor – IPexpert
Join our Online Study List

Friday, June 21, 2013

BGP Prevent Transit AS


BGP Prevent Transit AS

By default BGP will advertise all prefixes to EBGP (External BGP) neighbors. This means that if you are multi-homed (connected to two or more ISPs) that you might become a transit AS. Let me show you an example:
R1 two ISPs 3 loopbacks
R1 is connected to ISP1 and ISP2 and each router is in a different AS (Autonomous System). Since R1 is multi-homed it’s possible that the ISPs will use R1 to reach each other. In order to prevent this we’ll have to ensure that R1 only advertises prefixes from its own autonomous system.
As far as I know there are 4 methods how you can prevent becoming a transit AS:
  • Filter-list with AS PATH access-list.
  • No-Export Community.
  • Prefix-list Filtering
  • Distribute-list Filtering
Prefix-lists or distribute-lists will work but it’s not a very scalable solution if  you have thousands of prefixes in your BGP table. The filter-list and no-export community work very well since you only have to configure them once and it will not matter if new prefixes show up. First we’ll configure BGP on each router:
R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.12.2 remote-as 2
R1(config-router)#neighbor 192.168.13.3 remote-as 3
ISP1(config)#router bgp 2
ISP1(config-router)#neighbor 192.168.12.1 remote-as 1
ISP2(config)#router bgp 3
ISP2(config-router)#neighbor 192.168.13.1 remote-as 1
The commands above will configure EBGP (External BGP) between R1 – ISP1 and R1 – ISP2. To make sure we have something to look at, I’ll advertise the loopback interfaces in BGP on each router:
R1(config)#router bgp 1
R1(config-router)#network 1.1.1.0 mask 255.255.255.0
ISP1(config)#router bgp 2
ISP1(config-router)#network 2.2.2.0 mask 255.255.255.0
ISP2(config)#router bgp 3
ISP2(config-router)#network 3.3.3.0 mask 255.255.255.0
With the networks advertised, let’s take a look at the BGP table of ISP1 and ISP2 to see what they have learned:
ISP1#show ip bgp 
BGP table version is 4, local router ID is 11.11.11.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.12.1             0             0 1 i
*> 2.2.2.0/24       0.0.0.0                  0         32768 i
*> 3.3.3.0/24       192.168.12.1                           0 1 3 i
ISP2#show ip bgp 
BGP table version is 4, local router ID is 33.33.33.33
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.13.1             0             0 1 i
*> 2.2.2.0/24       192.168.13.1                           0 1 2 i
*> 3.3.3.0/24       0.0.0.0                  0         32768 i
The ISP routers have learned about each other networks and they will use R1 as the next hop. We now have everything in place to play with the different filtering techniques.

Filter-list with AS PATH access-list

Using an filter-list with the AS PATH access-list is probably the most convenient solution. It will ensure that you will always only advertise prefixes from your own autonomous system. Here’s how to do it:
R1(config)#ip as-path access-list 1 permit ^$

R1(config-router)#neighbor 192.168.12.2 filter-list 1 out
R1(config-router)#neighbor 192.168.13.3 filter-list 1 out
The ^$ regular expression ensures that we will only advertise locally originated prefixes. We’ll have to apply this filter to both ISPs.
Keep in mind that BGP is slow…if you are doing labs, it’s best to speed things up with clear ip bgp *
Let’s verify our configuration:
R1#show ip bgp 
BGP table version is 4, local router ID is 22.22.22.22
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       0.0.0.0                  0         32768 i
*> 2.2.2.0/24       192.168.12.2             0             0 2 i
*> 3.3.3.0/24       192.168.13.3             0             0 3 i
R1 still knows about the prefixes from the ISP routers. What about ISP1 and ISP2?
ISP1#show ip bgp 
BGP table version is 7, local router ID is 11.11.11.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.12.1             0             0 1 i
*> 2.2.2.0/24       0.0.0.0                  0         32768 i
ISP2#show ip bgp 
BGP table version is 7, local router ID is 33.33.33.33
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.13.1             0             0 1 i
*> 3.3.3.0/24       0.0.0.0                  0         32768 i
ISP1 and ISP2 only know about the 1.1.1.0 /24 network. Excellent, we are no longer a transit AS! On to the next method…

No-Export Community

Using the no-export community will also work pretty well. We will configure R1 so that prefixes from the ISP routers will be tagged with the no-export community. This ensures that the prefixes from those routers will be known within AS 1 but won’t be advertised to other routers.
R1(config)#route-map NO-EXPORT
R1(config-route-map)#set community no-export

R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.12.2 route-map NO-EXPORT in
R1(config-router)#neighbor 192.168.13.3 route-map NO-EXPORT in
I’m only using one router in AS 1, if you have other routers and are running IBGP (Internal BGP) then don’t forget to send communities to those routers with the neighbor <ip> send-community command.
Let’s see what ISP1 and ISP2 think about our configuration:
ISP1#show ip bgp 
BGP table version is 11, local router ID is 11.11.11.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.12.1             0             0 1 i
*> 2.2.2.0/24       0.0.0.0                  0         32768 i
ISP2#show ip bgp 
BGP table version is 11, local router ID is 33.33.33.33
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.13.1             0             0 1 i
*> 3.3.3.0/24       0.0.0.0                  0         32768 i
They only know about network 1.1.1.0 /24. Onto the next method!

Prefix-List Filtering

Using a prefix-list we can determine what prefixes are advertised to our BGP neighbors. This works fine but it’s not a good solution to prevent becoming a transit AS. Each time you add new prefixes you’ll have to reconfigure the prefix-list. Anyway let me show you how it works:
R1(config)#ip prefix-list NO-TRANSIT permit 1.1.1.0/24

R1(config-router)#neighbor 192.168.12.2 prefix-list NO-TRANSIT out 
R1(config-router)#neighbor 192.168.13.3 prefix-list NO-TRANSIT out
The prefix-list above will only advertise 1.1.1.0 /24 to the ISP routers. Let’s verify the configuration:
ISP1#show ip bgp 
BGP table version is 17, local router ID is 11.11.11.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.12.1             0             0 1 i
*> 2.2.2.0/24       0.0.0.0                  0         32768 i
ISP2#show ip bgp 
BGP table version is 17, local router ID is 33.33.33.33
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.13.1             0             0 1 i
*> 3.3.3.0/24       0.0.0.0                  0         32768 i
The prefix-list is working as it should, onto the last exercise!

Distribute-list Filtering

This method is similar to using the prefix-list but this time we’ll use an access-list.
R1(config)#ip access-list standard NO-TRANSIT
R1(config-std-nacl)#permit 1.1.1.0 0.0.0.255

R1(config-router)#neighbor 192.168.12.2 distribute-list NO-TRANSIT out
R1(config-router)#neighbor 192.168.13.3 distribute-list NO-TRANSIT out
Time to check the ISPs:
ISP1#show ip bgp 
BGP table version is 23, local router ID is 11.11.11.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.12.1             0             0 1 i
*> 2.2.2.0/24       0.0.0.0                  0         32768 i
ISP2#show ip bgp 
BGP table version is 23, local router ID is 33.33.33.33
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.13.1             0             0 1 i
*> 3.3.3.0/24       0.0.0.0                  0         32768 i
That’s all there is to it. I hope this has been helpful for you, if you know of any other methods to prevent becoming a BGP transit AS please leave a comment!

Thursday, June 20, 2013

BGP selection process

1.
Ignore a route if the next hop is not known.
2.
Ignore IBGP routes that are not synchronized.
3.
Prefer the route with the largest weight.
4.
Prefer the route with the largest local preference.
5.
Prefer the route that was locally originated.
6.
Prefer the route with the shortest AS path.

If you're using bgp bestpath as-path ignore, skip this step. When you use the as-set option for aggregated routes, as_set counts as 1 regardless of the number of AS entries in the set. Confederation sub-AS numbers are not used to determine the AS-path length.
7.
Prefer the route with the lowest origin (IGP < EGP < Incomplete).
8.
Prefer the route with the lowest MED.This comparison is only between routes advertised by the same external AS.

If you're using bgp always-compare-med, compare MEDs for all paths. If used, this command needs to be configured on every BGP router in the AS.

If you're using bgp bestpath med-confed, the MEDs are compared only for routes that have an AS confederation sequence in their AS-path attribute.

If a prefix is received with no MED value, the prefix is assigned a MED value of 0. If you're using bgp bestpath med missing-as-worst, a prefix with a missing MED value is assigned a MED value of 4,294,967,294.
9.
Prefer EBGP routes to IBGP routes.
10.
Prefer the route with the nearest IGP neighbor.
11.
Prefer the oldest route.
12.
Prefer the path received from the router with the lowest router ID.

Monday, June 10, 2013

Investment

 请问夜月兄:
1。如何计算一个公司的目前真正价值股呢!
2。如何知道Bursa的股价是合理呢!
3。要用什么作为选股的标准呢!如所为EPS…etc。
4。如何定PE&#139240;5,还有一些标准。不知夜月兄可以为我一一解释呢?
5。有什么网站是比较好,又能从网里寻找资料?

一题一题来 
1 首先,你先想象公司是一个人。
如何判断一个人的真正价值呢?

A 或许你会觉得直接看他的有形家产。
那就是Net Tangible assets (NTA) 
NTA=Total Assets-Total Liability-Intangible Assets

B 或许你会觉得看他的赚钱能力。
那就是看公司每年的Profit。

C 或许你会觉得他的名声比较重要。
那么就看公司的Brand或Company Name的出名度。

D 或许你会觉得性格比较重要。
那就看公司的文化。

E 或许你会觉得特质最重要。
那就看他的特许权。比如Tenaga,Tm,Airport都有特许权,没有竞争者。

到底哪一个比较重要呢?
那就要看你本身觉得了。
而且不同种类的公司需要注重的地方不同。


2 股票的价钱有两个:价值和价格
价值就是刚才第一题所提到的,
你自己觉得这家公司值多少钱?
价格就是目前股票的价钱。
价格是市场定的,
价值是你自己定的。
如果股票的价格低于价值时,
那么股票就是便宜的(Undervalued)
就好像你要买一件衣服,
如何知道衣服的价钱是合理的呢?
如果价格低过你对那件衣服的满意度,
那么就是值得的。
股票亦如此。


3 需要根据公司的种类而定
比方说Properties公司就要看NTA。
因为产业公司最有价值的就是他们的资产。
如果你看EPS就可能不准。
因为有时物价低时大量购进,
EPS就不漂亮。
相反的,如果Technology公司你看NTA就惨了。
因为Technology没有什么实体业务。
所以你要知道该公司值钱的地方在哪里。


4 PE也称为本益比
就是总成本和收益的对比
PE=share price*total shares/profit of one year
或是PE=share price/EPS
其实PE的本意是将股价和profitlink在一起。
PE代表了如果你买下整间公司,
以当年的获益能力,
你需要几年才能回本。
比方说: PE6意思是我需要6年时间才能赚回我买下公司的钱。


5 http://www.investalks.com/forum/ ... &extra=page%3D1
  先介绍investalk 
  这里有公司近3年的资料。
  爬完该公司的楼,
  基本上对公司都有一定的了解。
  
  http://www.malaysiastock.biz/Listed-Companies.aspx
  这里有公司的quarter report和dividend的summary.
  不过要register先。

  http://www.indexmundi.com/
  这里有原料的价格。

http://bursadailytradestatistics.blogspot.com/
bursa每天的交易记录

http://www.leinvest.com/about-the-author
大马新成立的网站,支持一下



Related Posts Plugin for WordPress, Blogger...